From: Greg Kroah-Hartman Date: Wed, 24 Dec 2014 21:01:39 +0000 (-0800) Subject: greybus: bundle: create GB_DEVICE_ID_BAD X-Git-Tag: v5.15~12752^2~378^2~21^2~1742 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b6ea0db016941a0919c17839c1772cceb1955c1;p=platform%2Fkernel%2Flinux-starfive.git greybus: bundle: create GB_DEVICE_ID_BAD Use a "name" for when we don't have a valid device id yet, instead of a magic value of 0xff. Reported-by: Alex Elder Signed-off-by: Greg Kroah-Hartman Reviewed-by: Alex Elder --- diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c index 973ea39..96153c5 100644 --- a/drivers/staging/greybus/bundle.c +++ b/drivers/staging/greybus/bundle.c @@ -91,9 +91,11 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 interface_id) bundle->intf = intf; bundle->id = interface_id; - bundle->device_id = 0xff; /* Invalid device id to start with */ INIT_LIST_HEAD(&bundle->connections); + /* Invalid device id to start with */ + bundle->device_id = GB_DEVICE_ID_BAD; + /* Build up the bundle device structures and register it with the * driver core */ bundle->dev.parent = &intf->dev; diff --git a/drivers/staging/greybus/bundle.h b/drivers/staging/greybus/bundle.h index e11d456..62969cf 100644 --- a/drivers/staging/greybus/bundle.h +++ b/drivers/staging/greybus/bundle.h @@ -24,6 +24,8 @@ struct gb_bundle { }; #define to_gb_bundle(d) container_of(d, struct gb_bundle, dev) +#define GB_DEVICE_ID_BAD 0xff + /* Greybus "private" definitions" */ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 module_id); void gb_bundle_destroy(struct gb_interface *intf); diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 2f70837..82b03c3 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -146,7 +146,7 @@ void gb_connection_bind_protocol(struct gb_connection *connection) * device, so bring up the connection at the same time. * */ bundle = connection->bundle; - if (bundle->device_id != 0xff) + if (bundle->device_id != GB_DEVICE_ID_BAD) gb_connection_init(connection); }