Because of this, rename greybus_module_id to greybus_interface_block_id.
We still need to add a way for a "class" driver to be bound to an
interface, but for now, all we really need is the vendor/product pair as
the GP Bridge interface block is going to be our main user.
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
{
struct greybus_driver *driver = to_greybus_driver(drv);
struct gb_interface_block *gb_ib = to_gb_interface_block(dev);
- const struct greybus_module_id *id;
+ const struct greybus_interface_block_id *id;
id = gb_ib_match_id(gb_ib, driver->id_table);
if (id)
{
struct greybus_driver *driver = to_greybus_driver(dev->driver);
struct gb_interface_block *gb_ib = to_gb_interface_block(dev);
- const struct greybus_module_id *id;
+ const struct greybus_interface_block_id *id;
int retval;
/* match id */
const char *name;
int (*probe)(struct gb_interface_block *gb_ib,
- const struct greybus_module_id *id);
+ const struct greybus_interface_block_id *id);
void (*disconnect)(struct gb_interface_block *gb_ib);
int (*suspend)(struct gb_interface_block *gb_ib, pm_message_t message);
int (*resume)(struct gb_interface_block *gb_ib);
- const struct greybus_module_id *id_table;
+ const struct greybus_interface_block_id *id_table;
struct device_driver driver;
};
#include <linux/mod_devicetable.h>
-struct greybus_module_id {
+struct greybus_interface_block_id {
__u16 match_flags;
__u16 vendor;
__u16 product;
kernel_ulong_t driver_info __aligned(sizeof(kernel_ulong_t));
};
-/* Used to match the greybus_module_id */
-#define GREYBUS_DEVICE_ID_MATCH_VENDOR BIT(0)
-#define GREYBUS_DEVICE_ID_MATCH_PRODUCT BIT(1)
-#define GREYBUS_DEVICE_ID_MATCH_SERIAL BIT(2)
+/* Used to match the greybus_interface_block_id */
+#define GREYBUS_ID_MATCH_VENDOR BIT(0)
+#define GREYBUS_ID_MATCH_PRODUCT BIT(1)
+#define GREYBUS_ID_MATCH_SERIAL BIT(2)
#endif /* __LINUX_GREYBUS_H */
/* XXX This could be per-host device */
static DEFINE_SPINLOCK(gb_modules_lock);
-static int gb_module_match_one_id(struct gb_interface_block *gb_ib,
- const struct greybus_module_id *id)
+static int gb_ib_match_one_id(struct gb_interface_block *gb_ib,
+ const struct greybus_interface_block_id *id)
{
- if ((id->match_flags & GREYBUS_DEVICE_ID_MATCH_VENDOR) &&
+ if ((id->match_flags & GREYBUS_ID_MATCH_VENDOR) &&
(id->vendor != gb_ib->vendor))
return 0;
- if ((id->match_flags & GREYBUS_DEVICE_ID_MATCH_PRODUCT) &&
+ if ((id->match_flags & GREYBUS_ID_MATCH_PRODUCT) &&
(id->product != gb_ib->product))
return 0;
- if ((id->match_flags & GREYBUS_DEVICE_ID_MATCH_SERIAL) &&
+ if ((id->match_flags & GREYBUS_ID_MATCH_SERIAL) &&
(id->unique_id != gb_ib->unique_id))
return 0;
return 1;
}
-const struct greybus_module_id *gb_ib_match_id(struct gb_interface_block *gb_ib,
- const struct greybus_module_id *id)
+const struct greybus_interface_block_id *
+gb_ib_match_id(struct gb_interface_block *gb_ib,
+ const struct greybus_interface_block_id *id)
{
if (id == NULL)
return NULL;
for (; id->vendor || id->product || id->unique_id ||
id->driver_info; id++) {
- if (gb_module_match_one_id(gb_ib, id))
+ if (gb_ib_match_one_id(gb_ib, id))
return id;
}
/* Greybus "private" definitions */
-const struct greybus_module_id *gb_ib_match_id(struct gb_interface_block *gb_ib,
- const struct greybus_module_id *id);
+const struct greybus_interface_block_id *
+ gb_ib_match_id(struct gb_interface_block *gb_ib,
+ const struct greybus_interface_block_id *id);
struct gb_interface_block *gb_ib_find(struct greybus_host_device *hd,
u8 module_id);