Commit e00a864f authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Jiri Kosina

HID: intel-ish-hid: Move driver registry functions

Move the driver registry with the ishtp bus to the common interface
file, which clients can include.
Also rename __ishtp_cl_driver_register() to ishtp_cl_driver_register()
and removed define for ishtp_cl_driver_register.
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent c2012ec0
...@@ -953,7 +953,7 @@ static int __init ish_hid_init(void) ...@@ -953,7 +953,7 @@ static int __init ish_hid_init(void)
int rv; int rv;
/* Register ISHTP client device driver with ISHTP Bus */ /* Register ISHTP client device driver with ISHTP Bus */
rv = ishtp_cl_driver_register(&hid_ishtp_cl_driver); rv = ishtp_cl_driver_register(&hid_ishtp_cl_driver, THIS_MODULE);
return rv; return rv;
......
...@@ -485,7 +485,7 @@ static void ishtp_bus_remove_device(struct ishtp_cl_device *device) ...@@ -485,7 +485,7 @@ static void ishtp_bus_remove_device(struct ishtp_cl_device *device)
} }
/** /**
* __ishtp_cl_driver_register() - Client driver register * ishtp_cl_driver_register() - Client driver register
* @driver: the client driver instance * @driver: the client driver instance
* @owner: Owner of this driver module * @owner: Owner of this driver module
* *
...@@ -494,8 +494,8 @@ static void ishtp_bus_remove_device(struct ishtp_cl_device *device) ...@@ -494,8 +494,8 @@ static void ishtp_bus_remove_device(struct ishtp_cl_device *device)
* *
* Return: Return value of driver_register or -ENODEV if not ready * Return: Return value of driver_register or -ENODEV if not ready
*/ */
int __ishtp_cl_driver_register(struct ishtp_cl_driver *driver, int ishtp_cl_driver_register(struct ishtp_cl_driver *driver,
struct module *owner) struct module *owner)
{ {
int err; int err;
...@@ -512,7 +512,7 @@ int __ishtp_cl_driver_register(struct ishtp_cl_driver *driver, ...@@ -512,7 +512,7 @@ int __ishtp_cl_driver_register(struct ishtp_cl_driver *driver,
return 0; return 0;
} }
EXPORT_SYMBOL(__ishtp_cl_driver_register); EXPORT_SYMBOL(ishtp_cl_driver_register);
/** /**
* ishtp_cl_driver_unregister() - Client driver unregister * ishtp_cl_driver_unregister() - Client driver unregister
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/intel-ish-client-if.h>
struct ishtp_cl; struct ishtp_cl;
struct ishtp_cl_device; struct ishtp_cl_device;
...@@ -52,26 +53,6 @@ struct ishtp_cl_device { ...@@ -52,26 +53,6 @@ struct ishtp_cl_device {
void (*event_cb)(struct ishtp_cl_device *device); void (*event_cb)(struct ishtp_cl_device *device);
}; };
/**
* struct ishtp_cl_device - ISHTP device handle
* @driver: driver instance on a bus
* @name: Name of the device for probe
* @probe: driver callback for device probe
* @remove: driver callback on device removal
*
* Client drivers defines to get probed/removed for ISHTP client device.
*/
struct ishtp_cl_driver {
struct device_driver driver;
const char *name;
const guid_t *guid;
int (*probe)(struct ishtp_cl_device *dev);
int (*remove)(struct ishtp_cl_device *dev);
int (*reset)(struct ishtp_cl_device *dev);
const struct dev_pm_ops *pm;
};
int ishtp_bus_new_client(struct ishtp_device *dev); int ishtp_bus_new_client(struct ishtp_device *dev);
void ishtp_remove_all_clients(struct ishtp_device *dev); void ishtp_remove_all_clients(struct ishtp_device *dev);
int ishtp_cl_device_bind(struct ishtp_cl *cl); int ishtp_cl_device_bind(struct ishtp_cl *cl);
...@@ -105,12 +86,6 @@ void ishtp_get_device(struct ishtp_cl_device *); ...@@ -105,12 +86,6 @@ void ishtp_get_device(struct ishtp_cl_device *);
void ishtp_set_drvdata(struct ishtp_cl_device *cl_device, void *data); void ishtp_set_drvdata(struct ishtp_cl_device *cl_device, void *data);
void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device); void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device);
int __ishtp_cl_driver_register(struct ishtp_cl_driver *driver,
struct module *owner);
#define ishtp_cl_driver_register(driver) \
__ishtp_cl_driver_register(driver, THIS_MODULE)
void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver);
int ishtp_register_event_cb(struct ishtp_cl_device *device, int ishtp_register_event_cb(struct ishtp_cl_device *device,
void (*read_cb)(struct ishtp_cl_device *)); void (*read_cb)(struct ishtp_cl_device *));
int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const guid_t *cuuid); int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const guid_t *cuuid);
......
...@@ -10,6 +10,31 @@ ...@@ -10,6 +10,31 @@
struct ishtp_cl_device; struct ishtp_cl_device;
/**
* struct ishtp_cl_device - ISHTP device handle
* @driver: driver instance on a bus
* @name: Name of the device for probe
* @probe: driver callback for device probe
* @remove: driver callback on device removal
*
* Client drivers defines to get probed/removed for ISHTP client device.
*/
struct ishtp_cl_driver {
struct device_driver driver;
const char *name;
const guid_t *guid;
int (*probe)(struct ishtp_cl_device *dev);
int (*remove)(struct ishtp_cl_device *dev);
int (*reset)(struct ishtp_cl_device *dev);
const struct dev_pm_ops *pm;
};
int ishtp_cl_driver_register(struct ishtp_cl_driver *driver,
struct module *owner);
void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver);
int ishtp_register_event_cb(struct ishtp_cl_device *device,
void (*read_cb)(struct ishtp_cl_device *));
/* Get the device * from ishtp device instance */ /* Get the device * from ishtp device instance */
struct device *ishtp_device(struct ishtp_cl_device *cl_device); struct device *ishtp_device(struct ishtp_cl_device *cl_device);
/* Trace interface for clients */ /* Trace interface for clients */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment