summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/greybus.h
diff options
context:
space:
mode:
authorFabien Parent <fparent@baylibre.com>2015-09-02 15:50:35 +0200
committerJohan Hovold <johan@hovoldconsulting.com>2015-09-02 16:21:54 +0200
commit144670c2ae3f9b452e021a9032b25730d296ba53 (patch)
treee7dbf67941f3380173139eedc333f6a7b0dc8151 /drivers/staging/greybus/greybus.h
parente074a2e2874aaa96da3e54d98ecb886201d96435 (diff)
greybus: add num_cports field to greybus hd
This commit is doing the preparation work in order to get the number of cports supported from the UniPro IP instead of using a constant defined in a Kconfig file. Greybus host device is now holding the cport count, and all the code will now use this value instead of the constant CPORT_ID_MAX when referring to an AP's CPort ID. Signed-off-by: Fabien Parent <fparent@baylibre.com> [johan: es1 supports 256 cports, minor style changes ] Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Diffstat (limited to 'drivers/staging/greybus/greybus.h')
-rw-r--r--drivers/staging/greybus/greybus.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/staging/greybus/greybus.h b/drivers/staging/greybus/greybus.h
index 57265558c682..27a772421529 100644
--- a/drivers/staging/greybus/greybus.h
+++ b/drivers/staging/greybus/greybus.h
@@ -96,6 +96,9 @@ struct greybus_host_device {
struct ida cport_id_map;
u8 device_id;
+ /* Number of CPorts supported by the UniPro IP */
+ size_t num_cports;
+
/* Host device buffer constraints */
size_t buffer_size_max;
@@ -109,7 +112,8 @@ struct greybus_host_device {
struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *hd,
struct device *parent,
- size_t buffer_size_max);
+ size_t buffer_size_max,
+ size_t num_cports);
int greybus_endo_setup(struct greybus_host_device *hd, u16 endo_id,
u8 ap_intf_id);
void greybus_remove_hd(struct greybus_host_device *hd);
@@ -191,9 +195,9 @@ static inline int is_gb_connection(const struct device *dev)
return dev->type == &greybus_connection_type;
}
-static inline bool cport_id_valid(u16 cport_id)
+static inline bool cport_id_valid(struct greybus_host_device *hd, u16 cport_id)
{
- return cport_id != CPORT_ID_BAD && cport_id <= CPORT_ID_MAX;
+ return cport_id != CPORT_ID_BAD && cport_id < hd->num_cports;
}
#endif /* __KERNEL__ */