Commit 5fd18b37 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

greybus: light : use the bundle struct device instead of the connector

We are removing struct device from the gb_connection structure in the
near future.  The gb_bundle structure's struct device should be used as
a replacement.

This patch moves the light driver to use the bundle pointer instead of
the connection pointer.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
parent 8d5732f4
...@@ -469,7 +469,7 @@ static void __gb_lights_channel_v4l2_config(struct led_flash_setting *channel_s, ...@@ -469,7 +469,7 @@ static void __gb_lights_channel_v4l2_config(struct led_flash_setting *channel_s,
static int gb_lights_light_v4l2_register(struct gb_light *light) static int gb_lights_light_v4l2_register(struct gb_light *light)
{ {
struct gb_connection *connection = get_conn_from_light(light); struct gb_connection *connection = get_conn_from_light(light);
struct device *dev = &connection->dev; struct device *dev = &connection->bundle->dev;
struct v4l2_flash_config *sd_cfg; struct v4l2_flash_config *sd_cfg;
struct led_classdev_flash *fled; struct led_classdev_flash *fled;
struct led_classdev_flash *iled = NULL; struct led_classdev_flash *iled = NULL;
...@@ -529,7 +529,7 @@ static int gb_lights_light_v4l2_register(struct gb_light *light) ...@@ -529,7 +529,7 @@ static int gb_lights_light_v4l2_register(struct gb_light *light)
{ {
struct gb_connection *connection = get_conn_from_light(light); struct gb_connection *connection = get_conn_from_light(light);
dev_err(&connection->dev, "no support for v4l2 subdevices\n"); dev_err(&connection->bundle->dev, "no support for v4l2 subdevices\n");
return 0; return 0;
} }
...@@ -791,7 +791,7 @@ static int gb_lights_channel_flash_config(struct gb_channel *channel) ...@@ -791,7 +791,7 @@ static int gb_lights_channel_flash_config(struct gb_channel *channel)
{ {
struct gb_connection *connection = get_conn_from_channel(channel); struct gb_connection *connection = get_conn_from_channel(channel);
dev_err(&connection->dev, "no support for flash devices\n"); dev_err(&connection->bundle->dev, "no support for flash devices\n");
return 0; return 0;
} }
...@@ -1090,7 +1090,7 @@ static int gb_lights_setup(struct gb_lights *glights) ...@@ -1090,7 +1090,7 @@ static int gb_lights_setup(struct gb_lights *glights)
for (i = 0; i < glights->lights_count; i++) { for (i = 0; i < glights->lights_count; i++) {
ret = gb_lights_light_config(glights, i); ret = gb_lights_light_config(glights, i);
if (ret < 0) { if (ret < 0) {
dev_err(&connection->dev, dev_err(&connection->bundle->dev,
"Fail to configure lights device\n"); "Fail to configure lights device\n");
goto out; goto out;
} }
...@@ -1104,6 +1104,7 @@ static int gb_lights_setup(struct gb_lights *glights) ...@@ -1104,6 +1104,7 @@ static int gb_lights_setup(struct gb_lights *glights)
static int gb_lights_event_recv(u8 type, struct gb_operation *op) static int gb_lights_event_recv(u8 type, struct gb_operation *op)
{ {
struct gb_connection *connection = op->connection; struct gb_connection *connection = op->connection;
struct device *dev = &connection->bundle->dev;
struct gb_lights *glights = connection->private; struct gb_lights *glights = connection->private;
struct gb_message *request; struct gb_message *request;
struct gb_lights_event_request *payload; struct gb_lights_event_request *payload;
...@@ -1112,16 +1113,14 @@ static int gb_lights_event_recv(u8 type, struct gb_operation *op) ...@@ -1112,16 +1113,14 @@ static int gb_lights_event_recv(u8 type, struct gb_operation *op)
u8 event; u8 event;
if (type != GB_LIGHTS_TYPE_EVENT) { if (type != GB_LIGHTS_TYPE_EVENT) {
dev_err(&connection->dev, dev_err(dev, "Unsupported unsolicited event: %u\n", type);
"Unsupported unsolicited event: %u\n", type);
return -EINVAL; return -EINVAL;
} }
request = op->request; request = op->request;
if (request->payload_size < sizeof(*payload)) { if (request->payload_size < sizeof(*payload)) {
dev_err(&connection->dev, dev_err(dev, "Wrong event size received (%zu < %zu)\n",
"Wrong event size received (%zu < %zu)\n",
request->payload_size, sizeof(*payload)); request->payload_size, sizeof(*payload));
return -EINVAL; return -EINVAL;
} }
...@@ -1130,8 +1129,7 @@ static int gb_lights_event_recv(u8 type, struct gb_operation *op) ...@@ -1130,8 +1129,7 @@ static int gb_lights_event_recv(u8 type, struct gb_operation *op)
light_id = payload->light_id; light_id = payload->light_id;
if (light_id >= glights->lights_count || !&glights->lights[light_id]) { if (light_id >= glights->lights_count || !&glights->lights[light_id]) {
dev_err(&connection->dev, dev_err(dev, "Event received for unconfigured light id: %d\n",
"Event received for unconfigured light id: %d\n",
light_id); light_id);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment