mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

icssg_prueth.c and icssg_prueth_sr1.c drivers use multiple common .c
files. These common objects are getting added to multiple modules. As a
result when both drivers are enabled in .config, below warning is seen.
drivers/net/ethernet/ti/Makefile: icssg/icssg_common.o is added to multiple modules: icssg-prueth icssg-prueth-sr1
drivers/net/ethernet/ti/Makefile: icssg/icssg_classifier.o is added to multiple modules: icssg-prueth icssg-prueth-sr1
drivers/net/ethernet/ti/Makefile: icssg/icssg_config.o is added to multiple modules: icssg-prueth icssg-prueth-sr1
drivers/net/ethernet/ti/Makefile: icssg/icssg_mii_cfg.o is added to multiple modules: icssg-prueth icssg-prueth-sr1
drivers/net/ethernet/ti/Makefile: icssg/icssg_stats.o is added to multiple modules: icssg-prueth icssg-prueth-sr1
drivers/net/ethernet/ti/Makefile: icssg/icssg_ethtool.o is added to multiple modules: icssg-prueth icssg-prueth-sr1
Fix this by building a new module (icssg.o) for all the common objects.
Both the driver can then depend on this common module.
Some APIs being exported have emac_ as the prefix which may result into
confusion with other existing APIs with emac_ prefix, to avoid
confusion, rename the APIs being exported with emac_ to icssg_ prefix.
This also fixes below error seen when both drivers are built.
ERROR: modpost: "icssg_queue_pop"
[drivers/net/ethernet/ti/icssg-prueth-sr1.ko] undefined!
ERROR: modpost: "icssg_queue_push"
[drivers/net/ethernet/ti/icssg-prueth-sr1.ko] undefined!
Reported-and-tested-by: Thorsten Leemhuis <linux@leemhuis.info>
Closes: https://lore.kernel.org/oe-kbuild-all/202405182038.ncf1mL7Z-lkp@intel.com/
Fixes: 487f7323f3
("net: ti: icssg-prueth: Add helper functions to configure FDB")
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
Reviewed-by: Sai Krishna <saikrishnag@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/* ICSSG Buffer queue helpers
|
|
*
|
|
* Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com
|
|
*/
|
|
|
|
#include <linux/regmap.h>
|
|
#include "icssg_prueth.h"
|
|
|
|
#define ICSSG_QUEUES_MAX 64
|
|
#define ICSSG_QUEUE_OFFSET 0xd00
|
|
#define ICSSG_QUEUE_PEEK_OFFSET 0xe00
|
|
#define ICSSG_QUEUE_CNT_OFFSET 0xe40
|
|
#define ICSSG_QUEUE_RESET_OFFSET 0xf40
|
|
|
|
int icssg_queue_pop(struct prueth *prueth, u8 queue)
|
|
{
|
|
u32 val, cnt;
|
|
|
|
if (queue >= ICSSG_QUEUES_MAX)
|
|
return -EINVAL;
|
|
|
|
regmap_read(prueth->miig_rt, ICSSG_QUEUE_CNT_OFFSET + 4 * queue, &cnt);
|
|
if (!cnt)
|
|
return -EINVAL;
|
|
|
|
regmap_read(prueth->miig_rt, ICSSG_QUEUE_OFFSET + 4 * queue, &val);
|
|
|
|
return val;
|
|
}
|
|
EXPORT_SYMBOL_GPL(icssg_queue_pop);
|
|
|
|
void icssg_queue_push(struct prueth *prueth, int queue, u16 addr)
|
|
{
|
|
if (queue >= ICSSG_QUEUES_MAX)
|
|
return;
|
|
|
|
regmap_write(prueth->miig_rt, ICSSG_QUEUE_OFFSET + 4 * queue, addr);
|
|
}
|
|
EXPORT_SYMBOL_GPL(icssg_queue_push);
|
|
|
|
u32 icssg_queue_level(struct prueth *prueth, int queue)
|
|
{
|
|
u32 reg;
|
|
|
|
if (queue >= ICSSG_QUEUES_MAX)
|
|
return 0;
|
|
|
|
regmap_read(prueth->miig_rt, ICSSG_QUEUE_CNT_OFFSET + 4 * queue, ®);
|
|
|
|
return reg;
|
|
}
|