Skip to content

Commit 68cc658

Browse files
ukleinekgregkh
authored andcommitted
fsi: Make fsi_bus_type a private variable to the core
There are no users of fsi_bus_type outside of fsi-core.c, so make that variable static, don't export it and drop the declaration from the public header file. As there is a usage of fsi_bus_type in fsi_create_device() the definition of that variable must happen further up in the file to not have to add a local declaration. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Acked-by: Eddie James <eajames@linux.ibm.com> Link: https://patch.msgid.link/bfd83034dec04d5a6b01a234988377fc6224614d.1765279318.git.u.kleine-koenig@baylibre.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 605fdba commit 68cc658

2 files changed

Lines changed: 33 additions & 35 deletions

File tree

drivers/fsi/fsi-core.c

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,39 @@ static int fsi_master_write(struct fsi_master *master, int link,
100100
uint8_t slave_id, uint32_t addr, const void *val, size_t size);
101101
static int fsi_master_break(struct fsi_master *master, int link);
102102

103+
/* FSI core & Linux bus type definitions */
104+
105+
static int fsi_bus_match(struct device *dev, const struct device_driver *drv)
106+
{
107+
struct fsi_device *fsi_dev = to_fsi_dev(dev);
108+
const struct fsi_driver *fsi_drv = to_fsi_drv(drv);
109+
const struct fsi_device_id *id;
110+
111+
if (!fsi_drv->id_table)
112+
return 0;
113+
114+
for (id = fsi_drv->id_table; id->engine_type; id++) {
115+
if (id->engine_type != fsi_dev->engine_type)
116+
continue;
117+
if (id->version == FSI_VERSION_ANY ||
118+
id->version == fsi_dev->version) {
119+
if (drv->of_match_table) {
120+
if (of_driver_match_device(dev, drv))
121+
return 1;
122+
} else {
123+
return 1;
124+
}
125+
}
126+
}
127+
128+
return 0;
129+
}
130+
131+
static const struct bus_type fsi_bus_type = {
132+
.name = "fsi",
133+
.match = fsi_bus_match,
134+
};
135+
103136
/*
104137
* fsi_device_read() / fsi_device_write() / fsi_device_peek()
105138
*
@@ -1359,34 +1392,6 @@ void fsi_master_unregister(struct fsi_master *master)
13591392
}
13601393
EXPORT_SYMBOL_GPL(fsi_master_unregister);
13611394

1362-
/* FSI core & Linux bus type definitions */
1363-
1364-
static int fsi_bus_match(struct device *dev, const struct device_driver *drv)
1365-
{
1366-
struct fsi_device *fsi_dev = to_fsi_dev(dev);
1367-
const struct fsi_driver *fsi_drv = to_fsi_drv(drv);
1368-
const struct fsi_device_id *id;
1369-
1370-
if (!fsi_drv->id_table)
1371-
return 0;
1372-
1373-
for (id = fsi_drv->id_table; id->engine_type; id++) {
1374-
if (id->engine_type != fsi_dev->engine_type)
1375-
continue;
1376-
if (id->version == FSI_VERSION_ANY ||
1377-
id->version == fsi_dev->version) {
1378-
if (drv->of_match_table) {
1379-
if (of_driver_match_device(dev, drv))
1380-
return 1;
1381-
} else {
1382-
return 1;
1383-
}
1384-
}
1385-
}
1386-
1387-
return 0;
1388-
}
1389-
13901395
int fsi_driver_register(struct fsi_driver *fsi_drv)
13911396
{
13921397
if (!fsi_drv)
@@ -1406,12 +1411,6 @@ void fsi_driver_unregister(struct fsi_driver *fsi_drv)
14061411
}
14071412
EXPORT_SYMBOL_GPL(fsi_driver_unregister);
14081413

1409-
const struct bus_type fsi_bus_type = {
1410-
.name = "fsi",
1411-
.match = fsi_bus_match,
1412-
};
1413-
EXPORT_SYMBOL_GPL(fsi_bus_type);
1414-
14151414
static int __init fsi_init(void)
14161415
{
14171416
int rc;

include/linux/fsi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ extern int fsi_slave_read(struct fsi_slave *slave, uint32_t addr,
7878
extern int fsi_slave_write(struct fsi_slave *slave, uint32_t addr,
7979
const void *val, size_t size);
8080

81-
extern const struct bus_type fsi_bus_type;
8281
extern const struct device_type fsi_cdev_type;
8382

8483
enum fsi_dev_type {

0 commit comments

Comments
 (0)