mei: bus: use mei_cldev_ prefix for the API functions

Use mei_cldev_ prefix for all mei client bus api functions
in order to resolve prefix conflict with functions that handle
client function and are defined in client.c

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Tomas Winkler 2015-09-10 10:18:05 +03:00 committed by Greg Kroah-Hartman
parent 893913822e
commit d49dc5e76f
5 changed files with 70 additions and 67 deletions

View File

@ -165,7 +165,7 @@ out:
} }
/** /**
* mei_cl_send - me device send (write) * mei_cldev_send - me device send (write)
* *
* @cldev: me client device * @cldev: me client device
* @buf: buffer to send * @buf: buffer to send
@ -173,7 +173,7 @@ out:
* *
* Return: written size in bytes or < 0 on error * Return: written size in bytes or < 0 on error
*/ */
ssize_t mei_cl_send(struct mei_cl_device *cldev, u8 *buf, size_t length) ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length)
{ {
struct mei_cl *cl = cldev->cl; struct mei_cl *cl = cldev->cl;
@ -182,10 +182,10 @@ ssize_t mei_cl_send(struct mei_cl_device *cldev, u8 *buf, size_t length)
return __mei_cl_send(cl, buf, length, 1); return __mei_cl_send(cl, buf, length, 1);
} }
EXPORT_SYMBOL_GPL(mei_cl_send); EXPORT_SYMBOL_GPL(mei_cldev_send);
/** /**
* mei_cl_recv - client receive (read) * mei_cldev_recv - client receive (read)
* *
* @cldev: me client device * @cldev: me client device
* @buf: buffer to send * @buf: buffer to send
@ -193,7 +193,7 @@ EXPORT_SYMBOL_GPL(mei_cl_send);
* *
* Return: read size in bytes of < 0 on error * Return: read size in bytes of < 0 on error
*/ */
ssize_t mei_cl_recv(struct mei_cl_device *cldev, u8 *buf, size_t length) ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length)
{ {
struct mei_cl *cl = cldev->cl; struct mei_cl *cl = cldev->cl;
@ -202,15 +202,15 @@ ssize_t mei_cl_recv(struct mei_cl_device *cldev, u8 *buf, size_t length)
return __mei_cl_recv(cl, buf, length); return __mei_cl_recv(cl, buf, length);
} }
EXPORT_SYMBOL_GPL(mei_cl_recv); EXPORT_SYMBOL_GPL(mei_cldev_recv);
/** /**
* mei_bus_event_work - dispatch rx event for a bus device * mei_cl_bus_event_work - dispatch rx event for a bus device
* and schedule new work * and schedule new work
* *
* @work: work * @work: work
*/ */
static void mei_bus_event_work(struct work_struct *work) static void mei_cl_bus_event_work(struct work_struct *work)
{ {
struct mei_cl_device *cldev; struct mei_cl_device *cldev;
@ -272,7 +272,7 @@ void mei_cl_bus_rx_event(struct mei_cl *cl)
} }
/** /**
* mei_cl_register_event_cb - register event callback * mei_cldev_register_event_cb - register event callback
* *
* @cldev: me client devices * @cldev: me client devices
* @event_cb: callback function * @event_cb: callback function
@ -283,9 +283,9 @@ void mei_cl_bus_rx_event(struct mei_cl *cl)
* -EALREADY if an callback is already registered * -EALREADY if an callback is already registered
* <0 on other errors * <0 on other errors
*/ */
int mei_cl_register_event_cb(struct mei_cl_device *cldev, int mei_cldev_register_event_cb(struct mei_cl_device *cldev,
unsigned long events_mask, unsigned long events_mask,
mei_cl_event_cb_t event_cb, void *context) mei_cldev_event_cb_t event_cb, void *context)
{ {
int ret; int ret;
@ -296,7 +296,7 @@ int mei_cl_register_event_cb(struct mei_cl_device *cldev,
cldev->events_mask = events_mask; cldev->events_mask = events_mask;
cldev->event_cb = event_cb; cldev->event_cb = event_cb;
cldev->event_context = context; cldev->event_context = context;
INIT_WORK(&cldev->event_work, mei_bus_event_work); INIT_WORK(&cldev->event_work, mei_cl_bus_event_work);
if (cldev->events_mask & BIT(MEI_CL_EVENT_RX)) { if (cldev->events_mask & BIT(MEI_CL_EVENT_RX)) {
ret = mei_cl_read_start(cldev->cl, 0, NULL); ret = mei_cl_read_start(cldev->cl, 0, NULL);
@ -314,32 +314,32 @@ int mei_cl_register_event_cb(struct mei_cl_device *cldev,
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(mei_cl_register_event_cb); EXPORT_SYMBOL_GPL(mei_cldev_register_event_cb);
/** /**
* mei_cl_get_drvdata - driver data getter * mei_cldev_get_drvdata - driver data getter
* *
* @cldev: mei client device * @cldev: mei client device
* *
* Return: driver private data * Return: driver private data
*/ */
void *mei_cl_get_drvdata(const struct mei_cl_device *cldev) void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev)
{ {
return dev_get_drvdata(&cldev->dev); return dev_get_drvdata(&cldev->dev);
} }
EXPORT_SYMBOL_GPL(mei_cl_get_drvdata); EXPORT_SYMBOL_GPL(mei_cldev_get_drvdata);
/** /**
* mei_cl_set_drvdata - driver data setter * mei_cldev_set_drvdata - driver data setter
* *
* @cldev: mei client device * @cldev: mei client device
* @data: data to store * @data: data to store
*/ */
void mei_cl_set_drvdata(struct mei_cl_device *cldev, void *data) void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data)
{ {
dev_set_drvdata(&cldev->dev, data); dev_set_drvdata(&cldev->dev, data);
} }
EXPORT_SYMBOL_GPL(mei_cl_set_drvdata); EXPORT_SYMBOL_GPL(mei_cldev_set_drvdata);
/** /**
* mei_cldev_uuid - return uuid of the underlying me client * mei_cldev_uuid - return uuid of the underlying me client
@ -381,14 +381,14 @@ bool mei_cldev_enabled(struct mei_cl_device *cldev)
EXPORT_SYMBOL_GPL(mei_cldev_enabled); EXPORT_SYMBOL_GPL(mei_cldev_enabled);
/** /**
* mei_cl_enable_device - enable me client device * mei_cldev_enable_device - enable me client device
* create connection with me client * create connection with me client
* *
* @cldev: me client device * @cldev: me client device
* *
* Return: 0 on success and < 0 on error * Return: 0 on success and < 0 on error
*/ */
int mei_cl_enable_device(struct mei_cl_device *cldev) int mei_cldev_enable(struct mei_cl_device *cldev)
{ {
struct mei_device *bus = cldev->bus; struct mei_device *bus = cldev->bus;
struct mei_cl *cl; struct mei_cl *cl;
@ -428,17 +428,17 @@ out:
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(mei_cl_enable_device); EXPORT_SYMBOL_GPL(mei_cldev_enable);
/** /**
* mei_cl_disable_device - disable me client device * mei_cldev_disable - disable me client device
* disconnect form the me client * disconnect form the me client
* *
* @cldev: me client device * @cldev: me client device
* *
* Return: 0 on success and < 0 on error * Return: 0 on success and < 0 on error
*/ */
int mei_cl_disable_device(struct mei_cl_device *cldev) int mei_cldev_disable(struct mei_cl_device *cldev)
{ {
struct mei_device *bus; struct mei_device *bus;
struct mei_cl *cl; struct mei_cl *cl;
@ -476,7 +476,7 @@ out:
mutex_unlock(&bus->device_lock); mutex_unlock(&bus->device_lock);
return err; return err;
} }
EXPORT_SYMBOL_GPL(mei_cl_disable_device); EXPORT_SYMBOL_GPL(mei_cldev_disable);
/** /**
* mei_cl_device_find - find matching entry in the driver id table * mei_cl_device_find - find matching entry in the driver id table
@ -663,14 +663,14 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
} }
static DEVICE_ATTR_RO(modalias); static DEVICE_ATTR_RO(modalias);
static struct attribute *mei_cl_dev_attrs[] = { static struct attribute *mei_cldev_attrs[] = {
&dev_attr_name.attr, &dev_attr_name.attr,
&dev_attr_uuid.attr, &dev_attr_uuid.attr,
&dev_attr_version.attr, &dev_attr_version.attr,
&dev_attr_modalias.attr, &dev_attr_modalias.attr,
NULL, NULL,
}; };
ATTRIBUTE_GROUPS(mei_cl_dev); ATTRIBUTE_GROUPS(mei_cldev);
/** /**
* mei_cl_device_uevent - me client bus uevent handler * mei_cl_device_uevent - me client bus uevent handler
@ -704,7 +704,7 @@ static int mei_cl_device_uevent(struct device *dev, struct kobj_uevent_env *env)
static struct bus_type mei_cl_bus_type = { static struct bus_type mei_cl_bus_type = {
.name = "mei", .name = "mei",
.dev_groups = mei_cl_dev_groups, .dev_groups = mei_cldev_groups,
.match = mei_cl_device_match, .match = mei_cl_device_match,
.probe = mei_cl_device_probe, .probe = mei_cl_device_probe,
.remove = mei_cl_device_remove, .remove = mei_cl_device_remove,
@ -937,7 +937,8 @@ void mei_cl_bus_rescan(struct mei_device *bus)
dev_dbg(bus->dev, "rescan end"); dev_dbg(bus->dev, "rescan end");
} }
int __mei_cl_driver_register(struct mei_cl_driver *cldrv, struct module *owner) int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
struct module *owner)
{ {
int err; int err;
@ -953,15 +954,15 @@ int __mei_cl_driver_register(struct mei_cl_driver *cldrv, struct module *owner)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(__mei_cl_driver_register); EXPORT_SYMBOL_GPL(__mei_cldev_driver_register);
void mei_cl_driver_unregister(struct mei_cl_driver *cldrv) void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv)
{ {
driver_unregister(&cldrv->driver); driver_unregister(&cldrv->driver);
pr_debug("mei: driver [%s] unregistered\n", cldrv->driver.name); pr_debug("mei: driver [%s] unregistered\n", cldrv->driver.name);
} }
EXPORT_SYMBOL_GPL(mei_cl_driver_unregister); EXPORT_SYMBOL_GPL(mei_cldev_driver_unregister);
int __init mei_cl_bus_init(void) int __init mei_cl_bus_init(void)

View File

@ -118,7 +118,7 @@ static int mei_nfc_if_version(struct nfc_mei_phy *phy)
cmd.sub_command = MEI_NFC_SUBCMD_IF_VERSION; cmd.sub_command = MEI_NFC_SUBCMD_IF_VERSION;
MEI_DUMP_NFC_HDR("version", &cmd.hdr); MEI_DUMP_NFC_HDR("version", &cmd.hdr);
r = mei_cl_send(phy->cldev, (u8 *)&cmd, sizeof(struct mei_nfc_cmd)); r = mei_cldev_send(phy->cldev, (u8 *)&cmd, sizeof(struct mei_nfc_cmd));
if (r < 0) { if (r < 0) {
pr_err("Could not send IF version cmd\n"); pr_err("Could not send IF version cmd\n");
return r; return r;
@ -132,7 +132,7 @@ static int mei_nfc_if_version(struct nfc_mei_phy *phy)
if (!reply) if (!reply)
return -ENOMEM; return -ENOMEM;
bytes_recv = mei_cl_recv(phy->cldev, (u8 *)reply, if_version_length); bytes_recv = mei_cldev_recv(phy->cldev, (u8 *)reply, if_version_length);
if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) { if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) {
pr_err("Could not read IF version\n"); pr_err("Could not read IF version\n");
r = -EIO; r = -EIO;
@ -186,13 +186,14 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)
connect->vendor_id = phy->vendor_id; connect->vendor_id = phy->vendor_id;
MEI_DUMP_NFC_HDR("connect request", &cmd->hdr); MEI_DUMP_NFC_HDR("connect request", &cmd->hdr);
r = mei_cl_send(phy->cldev, (u8 *)cmd, connect_length); r = mei_cldev_send(phy->cldev, (u8 *)cmd, connect_length);
if (r < 0) { if (r < 0) {
pr_err("Could not send connect cmd %d\n", r); pr_err("Could not send connect cmd %d\n", r);
goto err; goto err;
} }
bytes_recv = mei_cl_recv(phy->cldev, (u8 *)reply, connect_resp_length); bytes_recv = mei_cldev_recv(phy->cldev, (u8 *)reply,
connect_resp_length);
if (bytes_recv < 0) { if (bytes_recv < 0) {
r = bytes_recv; r = bytes_recv;
pr_err("Could not read connect response %d\n", r); pr_err("Could not read connect response %d\n", r);
@ -238,7 +239,7 @@ static int mei_nfc_send(struct nfc_mei_phy *phy, u8 *buf, size_t length)
MEI_DUMP_NFC_HDR("send", hdr); MEI_DUMP_NFC_HDR("send", hdr);
memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length); memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length);
err = mei_cl_send(phy->cldev, mei_buf, length + MEI_NFC_HEADER_SIZE); err = mei_cldev_send(phy->cldev, mei_buf, length + MEI_NFC_HEADER_SIZE);
if (err < 0) if (err < 0)
goto out; goto out;
@ -278,7 +279,7 @@ static int mei_nfc_recv(struct nfc_mei_phy *phy, u8 *buf, size_t length)
struct mei_nfc_hdr *hdr; struct mei_nfc_hdr *hdr;
int received_length; int received_length;
received_length = mei_cl_recv(phy->cldev, buf, length); received_length = mei_cldev_recv(phy->cldev, buf, length);
if (received_length < 0) if (received_length < 0)
return received_length; return received_length;
@ -337,7 +338,7 @@ static int nfc_mei_phy_enable(void *phy_id)
if (phy->powered == 1) if (phy->powered == 1)
return 0; return 0;
r = mei_cl_enable_device(phy->cldev); r = mei_cldev_enable(phy->cldev);
if (r < 0) { if (r < 0) {
pr_err("Could not enable device %d\n", r); pr_err("Could not enable device %d\n", r);
return r; return r;
@ -355,7 +356,7 @@ static int nfc_mei_phy_enable(void *phy_id)
goto err; goto err;
} }
r = mei_cl_register_event_cb(phy->cldev, BIT(MEI_CL_EVENT_RX), r = mei_cldev_register_event_cb(phy->cldev, BIT(MEI_CL_EVENT_RX),
nfc_mei_event_cb, phy); nfc_mei_event_cb, phy);
if (r) { if (r) {
pr_err("Event cb registration failed %d\n", r); pr_err("Event cb registration failed %d\n", r);
@ -368,7 +369,7 @@ static int nfc_mei_phy_enable(void *phy_id)
err: err:
phy->powered = 0; phy->powered = 0;
mei_cl_disable_device(phy->cldev); mei_cldev_disable(phy->cldev);
return r; return r;
} }
@ -378,7 +379,7 @@ static void nfc_mei_phy_disable(void *phy_id)
pr_info("%s\n", __func__); pr_info("%s\n", __func__);
mei_cl_disable_device(phy->cldev); mei_cldev_disable(phy->cldev);
phy->powered = 0; phy->powered = 0;
} }
@ -400,7 +401,7 @@ struct nfc_mei_phy *nfc_mei_phy_alloc(struct mei_cl_device *cldev)
phy->cldev = cldev; phy->cldev = cldev;
init_waitqueue_head(&phy->send_wq); init_waitqueue_head(&phy->send_wq);
mei_cl_set_drvdata(cldev, phy); mei_cldev_set_drvdata(cldev, phy);
return phy; return phy;
} }
@ -408,7 +409,7 @@ EXPORT_SYMBOL_GPL(nfc_mei_phy_alloc);
void nfc_mei_phy_free(struct nfc_mei_phy *phy) void nfc_mei_phy_free(struct nfc_mei_phy *phy)
{ {
mei_cl_disable_device(phy->cldev); mei_cldev_disable(phy->cldev);
kfree(phy); kfree(phy);
} }
EXPORT_SYMBOL_GPL(nfc_mei_phy_free); EXPORT_SYMBOL_GPL(nfc_mei_phy_free);

View File

@ -57,7 +57,7 @@ static int microread_mei_probe(struct mei_cl_device *cldev,
static int microread_mei_remove(struct mei_cl_device *cldev) static int microread_mei_remove(struct mei_cl_device *cldev)
{ {
struct nfc_mei_phy *phy = mei_cl_get_drvdata(cldev); struct nfc_mei_phy *phy = mei_cldev_get_drvdata(cldev);
microread_remove(phy->hdev); microread_remove(phy->hdev);
@ -88,7 +88,7 @@ static int microread_mei_init(void)
pr_debug(DRIVER_DESC ": %s\n", __func__); pr_debug(DRIVER_DESC ": %s\n", __func__);
r = mei_cl_driver_register(&microread_driver); r = mei_cldev_driver_register(&microread_driver);
if (r) { if (r) {
pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n"); pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n");
return r; return r;
@ -99,7 +99,7 @@ static int microread_mei_init(void)
static void microread_mei_exit(void) static void microread_mei_exit(void)
{ {
mei_cl_driver_unregister(&microread_driver); mei_cldev_driver_unregister(&microread_driver);
} }
module_init(microread_mei_init); module_init(microread_mei_init);

View File

@ -55,7 +55,7 @@ static int pn544_mei_probe(struct mei_cl_device *cldev,
static int pn544_mei_remove(struct mei_cl_device *cldev) static int pn544_mei_remove(struct mei_cl_device *cldev)
{ {
struct nfc_mei_phy *phy = mei_cl_get_drvdata(cldev); struct nfc_mei_phy *phy = mei_cldev_get_drvdata(cldev);
pr_info("Removing pn544\n"); pr_info("Removing pn544\n");
@ -88,7 +88,7 @@ static int pn544_mei_init(void)
pr_debug(DRIVER_DESC ": %s\n", __func__); pr_debug(DRIVER_DESC ": %s\n", __func__);
r = mei_cl_driver_register(&pn544_driver); r = mei_cldev_driver_register(&pn544_driver);
if (r) { if (r) {
pr_err(PN544_DRIVER_NAME ": driver registration failed\n"); pr_err(PN544_DRIVER_NAME ": driver registration failed\n");
return r; return r;
@ -99,7 +99,7 @@ static int pn544_mei_init(void)
static void pn544_mei_exit(void) static void pn544_mei_exit(void)
{ {
mei_cl_driver_unregister(&pn544_driver); mei_cldev_driver_unregister(&pn544_driver);
} }
module_init(pn544_mei_init); module_init(pn544_mei_init);

View File

@ -8,7 +8,7 @@
struct mei_cl_device; struct mei_cl_device;
struct mei_device; struct mei_device;
typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *cldev, typedef void (*mei_cldev_event_cb_t)(struct mei_cl_device *cldev,
u32 events, void *context); u32 events, void *context);
/** /**
@ -45,7 +45,7 @@ struct mei_cl_device {
char name[MEI_CL_NAME_SIZE]; char name[MEI_CL_NAME_SIZE];
struct work_struct event_work; struct work_struct event_work;
mei_cl_event_cb_t event_cb; mei_cldev_event_cb_t event_cb;
void *event_context; void *event_context;
unsigned long events_mask; unsigned long events_mask;
unsigned long events; unsigned long events;
@ -67,18 +67,19 @@ struct mei_cl_driver {
int (*remove)(struct mei_cl_device *cldev); int (*remove)(struct mei_cl_device *cldev);
}; };
int __mei_cl_driver_register(struct mei_cl_driver *cldrv, struct module *owner); int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
#define mei_cl_driver_register(cldrv) \ struct module *owner);
__mei_cl_driver_register(cldrv, THIS_MODULE) #define mei_cldev_driver_register(cldrv) \
__mei_cldev_driver_register(cldrv, THIS_MODULE)
void mei_cl_driver_unregister(struct mei_cl_driver *cldrv); void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv);
ssize_t mei_cl_send(struct mei_cl_device *cldev, u8 *buf, size_t length); ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length);
ssize_t mei_cl_recv(struct mei_cl_device *cldev, u8 *buf, size_t length); ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length);
int mei_cl_register_event_cb(struct mei_cl_device *cldev, int mei_cldev_register_event_cb(struct mei_cl_device *cldev,
unsigned long event_mask, unsigned long event_mask,
mei_cl_event_cb_t read_cb, void *context); mei_cldev_event_cb_t read_cb, void *context);
#define MEI_CL_EVENT_RX 0 #define MEI_CL_EVENT_RX 0
#define MEI_CL_EVENT_TX 1 #define MEI_CL_EVENT_TX 1
@ -87,11 +88,11 @@ int mei_cl_register_event_cb(struct mei_cl_device *cldev,
const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev); const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev);
u8 mei_cldev_ver(const struct mei_cl_device *cldev); u8 mei_cldev_ver(const struct mei_cl_device *cldev);
void *mei_cl_get_drvdata(const struct mei_cl_device *cldev); void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev);
void mei_cl_set_drvdata(struct mei_cl_device *cldev, void *data); void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data);
int mei_cl_enable_device(struct mei_cl_device *cldev); int mei_cldev_enable(struct mei_cl_device *cldev);
int mei_cl_disable_device(struct mei_cl_device *cldev); int mei_cldev_disable(struct mei_cl_device *cldev);
bool mei_cldev_enabled(struct mei_cl_device *cldev); bool mei_cldev_enabled(struct mei_cl_device *cldev);
#endif /* _LINUX_MEI_CL_BUS_H */ #endif /* _LINUX_MEI_CL_BUS_H */