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.
Unified · Split
| @@ -953,7 +953,7 @@ static int __init ish_hid_init(void) · 952 unmodified lines | |||
| 953 | int rv; | 953 | int rv; |
| 954 | 954 | ||
| 955 | /* Register ISHTP client device driver with ISHTP Bus */ | 955 | /* Register ISHTP client device driver with ISHTP Bus */ |
| 956 | rv = ishtp_cl_driver_register(&hid_ishtp_cl_driver); | 956 | rv = ishtp_cl_driver_register(&hid_ishtp_cl_driver, THIS_MODULE); |
| 957 | 957 | ||
| 958 | return rv; | 958 | return rv; |
| 959 | 959 | ||
| @@ -485,7 +485,7 @@ static void ishtp_bus_remove_device(struct ishtp_cl_device *device) · 484 unmodified lines | |||
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | /** | 487 | /** |
| 488 | * __ishtp_cl_driver_register() - Client driver register | 488 | * ishtp_cl_driver_register() - Client driver register |
| 489 | * @driver: the client driver instance | 489 | * @driver: the client driver instance |
| 490 | * @owner: Owner of this driver module | 490 | * @owner: Owner of this driver module |
| 491 | * | 491 | * |
| @@ -494,8 +494,8 @@ static void ishtp_bus_remove_device(struct ishtp_cl_device *device) · 2 unmodified lines | |||
| 494 | * | 494 | * |
| 495 | * Return: Return value of driver_register or -ENODEV if not ready | 495 | * Return: Return value of driver_register or -ENODEV if not ready |
| 496 | */ | 496 | */ |
| 497 | int __ishtp_cl_driver_register(struct ishtp_cl_driver *driver, | 497 | int ishtp_cl_driver_register(struct ishtp_cl_driver *driver, |
| 498 | struct module *owner) | 498 | struct module *owner) |
| 499 | { | 499 | { |
| 500 | int err; | 500 | int err; |
| 501 | 501 | ||
| @@ -512,7 +512,7 @@ int __ishtp_cl_driver_register(struct ishtp_cl_driver *driver, · 10 unmodified lines | |||
| 512 | 512 | ||
| 513 | return 0; | 513 | return 0; |
| 514 | } | 514 | } |
| 515 | EXPORT_SYMBOL(__ishtp_cl_driver_register); | 515 | EXPORT_SYMBOL(ishtp_cl_driver_register); |
| 516 | 516 | ||
| 517 | /** | 517 | /** |
| 518 | * ishtp_cl_driver_unregister() - Client driver unregister | 518 | * ishtp_cl_driver_unregister() - Client driver unregister |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | 17 | ||
| 18 | #include <linux/device.h> | 18 | #include <linux/device.h> |
| 19 | #include <linux/mod_devicetable.h> | 19 | #include <linux/mod_devicetable.h> |
| 20 | #include <linux/intel-ish-client-if.h> | ||
| 20 | 21 | ||
| 21 | struct ishtp_cl; | 22 | struct ishtp_cl; |
| 22 | struct ishtp_cl_device; | 23 | struct ishtp_cl_device; |
| @@ -52,26 +53,6 @@ struct ishtp_cl_device { · 29 unmodified lines | |||
| 52 | void (*event_cb)(struct ishtp_cl_device *device); | 53 | void (*event_cb)(struct ishtp_cl_device *device); |
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| 55 | /** | ||
| 56 | * struct ishtp_cl_device - ISHTP device handle | ||
| 57 | * @driver: driver instance on a bus | ||
| 58 | * @name: Name of the device for probe | ||
| 59 | * @probe: driver callback for device probe | ||
| 60 | * @remove: driver callback on device removal | ||
| 61 | * | ||
| 62 | * Client drivers defines to get probed/removed for ISHTP client device. | ||
| 63 | */ | ||
| 64 | struct ishtp_cl_driver { | ||
| 65 | struct device_driver driver; | ||
| 66 | const char *name; | ||
| 67 | const guid_t *guid; | ||
| 68 | int (*probe)(struct ishtp_cl_device *dev); | ||
| 69 | int (*remove)(struct ishtp_cl_device *dev); | ||
| 70 | int (*reset)(struct ishtp_cl_device *dev); | ||
| 71 | const struct dev_pm_ops *pm; | ||
| 72 | }; | ||
| 73 | |||
| 74 | |||
| 75 | int ishtp_bus_new_client(struct ishtp_device *dev); | 56 | int ishtp_bus_new_client(struct ishtp_device *dev); |
| 76 | void ishtp_remove_all_clients(struct ishtp_device *dev); | 57 | void ishtp_remove_all_clients(struct ishtp_device *dev); |
| 77 | int ishtp_cl_device_bind(struct ishtp_cl *cl); | 58 | int ishtp_cl_device_bind(struct ishtp_cl *cl); |
| @@ -105,12 +86,6 @@ void ishtp_get_device(struct ishtp_cl_device *); · 27 unmodified lines | |||
| 105 | void ishtp_set_drvdata(struct ishtp_cl_device *cl_device, void *data); | 86 | void ishtp_set_drvdata(struct ishtp_cl_device *cl_device, void *data); |
| 106 | void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device); | 87 | void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device); |
| 107 | 88 | ||
| 108 | int __ishtp_cl_driver_register(struct ishtp_cl_driver *driver, | ||
| 109 | struct module *owner); | ||
| 110 | #define ishtp_cl_driver_register(driver) \ | ||
| 111 | __ishtp_cl_driver_register(driver, THIS_MODULE) | ||
| 112 | void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver); | ||
| 113 | |||
| 114 | int ishtp_register_event_cb(struct ishtp_cl_device *device, | 89 | int ishtp_register_event_cb(struct ishtp_cl_device *device, |
| 115 | void (*read_cb)(struct ishtp_cl_device *)); | 90 | void (*read_cb)(struct ishtp_cl_device *)); |
| 116 | int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const guid_t *cuuid); | 91 | int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const guid_t *cuuid); |
| @@ -10,6 +10,31 @@ · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | struct ishtp_cl_device; | 11 | struct ishtp_cl_device; |
| 12 | 12 | ||
| 13 | /** | ||
| 14 | * struct ishtp_cl_device - ISHTP device handle | ||
| 15 | * @driver: driver instance on a bus | ||
| 16 | * @name: Name of the device for probe | ||
| 17 | * @probe: driver callback for device probe | ||
| 18 | * @remove: driver callback on device removal | ||
| 19 | * | ||
| 20 | * Client drivers defines to get probed/removed for ISHTP client device. | ||
| 21 | */ | ||
| 22 | struct ishtp_cl_driver { | ||
| 23 | struct device_driver driver; | ||
| 24 | const char *name; | ||
| 25 | const guid_t *guid; | ||
| 26 | int (*probe)(struct ishtp_cl_device *dev); | ||
| 27 | int (*remove)(struct ishtp_cl_device *dev); | ||
| 28 | int (*reset)(struct ishtp_cl_device *dev); | ||
| 29 | const struct dev_pm_ops *pm; | ||
| 30 | }; | ||
| 31 | |||
| 32 | int ishtp_cl_driver_register(struct ishtp_cl_driver *driver, | ||
| 33 | struct module *owner); | ||
| 34 | void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver); | ||
| 35 | int ishtp_register_event_cb(struct ishtp_cl_device *device, | ||
| 36 | void (*read_cb)(struct ishtp_cl_device *)); | ||
| 37 | |||
| 13 | /* Get the device * from ishtp device instance */ | 38 | /* Get the device * from ishtp device instance */ |
| 14 | struct device *ishtp_device(struct ishtp_cl_device *cl_device); | 39 | struct device *ishtp_device(struct ishtp_cl_device *cl_device); |
| 15 | /* Trace interface for clients */ | 40 | /* Trace interface for clients */ |