alistair23-linux/drivers/staging/greybus/interface.h
Greg Kroah-Hartman 86cad66677 greybus: interface: remove global manifest_descs list
The list was global and had no locking.  It's not like we were ever
parsing more than one manifest at the same time right now, but we might
in the future.  And we really want this to be local to the interface
itself, for future work redoing how to bind protocols to bundles, so
move the list to the interface structure.

Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-12-23 21:00:33 -08:00

61 lines
1.5 KiB
C

/*
* Greybus Interface Block code
*
* Copyright 2014 Google Inc.
* Copyright 2014 Linaro Ltd.
*
* Released under the GPLv2 only.
*/
#ifndef __INTERFACE_H
#define __INTERFACE_H
/* Greybus "public" definitions" */
struct gb_interface {
struct device dev;
struct list_head bundles;
struct list_head links; /* greybus_host_device->interfaces */
struct list_head manifest_descs;
u8 interface_id; /* Physical location within the Endo */
/* Information taken from the manifest module descriptor */
u16 vendor;
u16 product;
char *vendor_string;
char *product_string;
u64 unique_id;
struct gb_module *module;
struct greybus_host_device *hd;
};
#define to_gb_interface(d) container_of(d, struct gb_interface, dev)
static inline void gb_interface_set_drvdata(struct gb_interface *intf,
void *data)
{
dev_set_drvdata(&intf->dev, data);
}
static inline void * gb_interface__get_drvdata(struct gb_interface *intf)
{
return dev_get_drvdata(&intf->dev);
}
/* Greybus "private" definitions */
const struct greybus_interface_id *
gb_interface_match_id(struct gb_interface *intf,
const struct greybus_interface_id *id);
struct gb_interface *gb_interface_find(struct greybus_host_device *hd,
u8 module_id);
void gb_add_interface(struct greybus_host_device *hd, u8 module_id,
u8 *data, int size);
void gb_remove_interface(struct greybus_host_device *hd, u8 module_id);
void gb_remove_interfaces(struct greybus_host_device *hd);
#endif /* __INTERFACE_H */