]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
greybus: convert drivers to use connection->private set/get
authorGreg Kroah-Hartman <gregkh@google.com>
Tue, 22 Mar 2016 18:30:35 +0000 (14:30 -0400)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 22 Mar 2016 20:47:28 +0000 (16:47 -0400)
This converts all drivers to use the gb_connection_get_data() and
gb_connection_set_data() functions to make it a bit more explicit as to
what is going on.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
16 files changed:
drivers/staging/greybus/audio_codec.c
drivers/staging/greybus/camera.c
drivers/staging/greybus/control.c
drivers/staging/greybus/firmware.c
drivers/staging/greybus/gpio.c
drivers/staging/greybus/hid.c
drivers/staging/greybus/i2c.c
drivers/staging/greybus/light.c
drivers/staging/greybus/power_supply.c
drivers/staging/greybus/pwm.c
drivers/staging/greybus/sdio.c
drivers/staging/greybus/spi.c
drivers/staging/greybus/svc.c
drivers/staging/greybus/uart.c
drivers/staging/greybus/usb.c
drivers/staging/greybus/vibrator.c

index 025dd53507b7f2db67d98087c4bcf795a4100671..30b381ab8a1f07a50a0088a6c2d15d40ff3d4906 100644 (file)
@@ -675,7 +675,7 @@ static int gb_audio_add_mgmt_connection(struct gbaudio_codec_info *gbcodec,
        if (IS_ERR(connection))
                return PTR_ERR(connection);
 
-       connection->private = gbcodec;
+       gb_connection_set_data(connection, gbcodec);
        gbcodec->mgmt_connection = connection;
 
        return 0;
@@ -703,7 +703,7 @@ static int gb_audio_add_data_connection(struct gbaudio_codec_info *gbcodec,
                return PTR_ERR(connection);
        }
 
-       connection->private = gbcodec;
+       gb_connection_set_data(connection, gbcodec);
        atomic_set(&dai->users, 0);
        init_waitqueue_head(&dai->wait_queue);
        dai->data_cport = connection->intf_cport_id;
index 722f2b4fe54d3e0bf323964ef22e37dfeabc5f5b..a871b0f33733164351e9277a67dace2f4ea3384f 100644 (file)
@@ -374,7 +374,7 @@ static int gb_camera_flush(struct gb_camera *gcam, u32 *request_id)
 
 static int gb_camera_event_recv(u8 type, struct gb_operation *op)
 {
-       struct gb_camera *gcam = op->connection->private;
+       struct gb_camera *gcam = gb_connection_get_data(op->connection);
        struct gb_camera_metadata_request *payload;
        struct gb_message *request;
 
@@ -904,7 +904,7 @@ static int gb_camera_connection_init(struct gb_connection *connection)
                return -ENOMEM;
 
        gcam->connection = connection;
-       connection->private = gcam;
+       gb_connection_set_data(connection, gcam);
 
        /*
         * Create the data connection between camera module CDSI0 and APB CDS1.
@@ -936,7 +936,7 @@ error:
 
 static void gb_camera_connection_exit(struct gb_connection *connection)
 {
-       struct gb_camera *gcam = connection->private;
+       struct gb_camera *gcam = gb_connection_get_data(connection);
 
        gb_camera_unregister_intf_ops(gcam);
 
index bac412ef72ab3e40937ee586bef3feca576240e6..83be255bb5341da9ee89f44fee608380382c5957 100644 (file)
@@ -195,7 +195,7 @@ struct gb_control *gb_control_create(struct gb_interface *intf)
                return NULL;
        }
 
-       control->connection->private = control;
+       gb_connection_set_data(control->connection, control);
 
        return control;
 }
index 17ce573b9162190f43206315ea6d01dfb46edd72..b1188b23ffe52dd40b86f7cf7bdb722289facd75 100644 (file)
@@ -115,11 +115,10 @@ static int download_firmware(struct gb_firmware *firmware, u8 stage)
 
 static int gb_firmware_size_request(struct gb_operation *op)
 {
-       struct gb_connection *connection = op->connection;
-       struct gb_firmware *firmware = connection->private;
+       struct gb_firmware *firmware = gb_connection_get_data(op->connection);
        struct gb_firmware_size_request *size_request = op->request->payload;
        struct gb_firmware_size_response *size_response;
-       struct device *dev = &connection->bundle->dev;
+       struct device *dev = &op->connection->bundle->dev;
        int ret;
 
        if (op->request->payload_size != sizeof(*size_request)) {
@@ -153,12 +152,11 @@ static int gb_firmware_size_request(struct gb_operation *op)
 
 static int gb_firmware_get_firmware(struct gb_operation *op)
 {
-       struct gb_connection *connection = op->connection;
-       struct gb_firmware *firmware = connection->private;
+       struct gb_firmware *firmware = gb_connection_get_data(op->connection);
        const struct firmware *fw = firmware->fw;
        struct gb_firmware_get_firmware_request *firmware_request;
        struct gb_firmware_get_firmware_response *firmware_response;
-       struct device *dev = &connection->bundle->dev;
+       struct device *dev = &op->connection->bundle->dev;
        unsigned int offset, size;
 
        if (op->request->payload_size != sizeof(*firmware_request)) {
@@ -309,7 +307,7 @@ static int gb_firmware_probe(struct gb_bundle *bundle,
                goto err_free_firmware;
        }
 
-       connection->private = firmware;
+       gb_connection_set_data(connection, firmware);
 
        firmware->connection = connection;
 
index 7b2cb5d81e54b52ebaa9e57d8427f1e4c5fd4c3b..440ff44c85248d022ad0cc5129289c3995722859 100644 (file)
@@ -351,7 +351,7 @@ static int gb_gpio_request_recv(u8 type, struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;
        struct device *dev = &connection->bundle->dev;
-       struct gb_gpio_controller *ggc = connection->private;
+       struct gb_gpio_controller *ggc = gb_connection_get_data(connection);
        struct gb_message *request;
        struct gb_gpio_irq_event_request *event;
        int irq;
@@ -633,7 +633,7 @@ static int gb_gpio_connection_init(struct gb_connection *connection)
        if (!ggc)
                return -ENOMEM;
        ggc->connection = connection;
-       connection->private = ggc;
+       gb_connection_set_data(connection, ggc);
 
        ret = gb_gpio_controller_setup(ggc);
        if (ret)
@@ -700,7 +700,7 @@ err_free_controller:
 
 static void gb_gpio_connection_exit(struct gb_connection *connection)
 {
-       struct gb_gpio_controller *ggc = connection->private;
+       struct gb_gpio_controller *ggc = gb_connection_get_data(connection);
 
        if (!ggc)
                return;
index 6ef151f61ffc8d4c09001082ae3f43480df5dfb4..fd4a7e096450869cbd2a5190886bd1db1b588592 100644 (file)
@@ -100,7 +100,7 @@ static int gb_hid_set_report(struct gb_hid *ghid, u8 report_type, u8 report_id,
 static int gb_hid_request_handler(struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;
-       struct gb_hid *ghid = connection->private;
+       struct gb_hid *ghid = gb_connection_get_data(connection);
        struct gb_hid_input_report_request *request = op->request->payload;
 
        if (op->type != GB_HID_TYPE_IRQ_EVENT) {
@@ -449,7 +449,7 @@ static int gb_hid_probe(struct gb_bundle *bundle,
                goto err_free_ghid;
        }
 
-       connection->private = ghid;
+       gb_connection_set_data(connection, ghid);
        ghid->connection = connection;
 
        hid = hid_allocate_device();
index 4b96f69318bdae7e8325a2b38bc8c94f1d853f79..73b85815d1eb1ea70cbdfceb03a02dce45ac6e12 100644 (file)
@@ -251,7 +251,7 @@ static int gb_i2c_connection_init(struct gb_connection *connection)
                return -ENOMEM;
 
        gb_i2c_dev->connection = connection;    /* refcount? */
-       connection->private = gb_i2c_dev;
+       gb_connection_set_data(connection, gb_i2c_dev);
 
        ret = gb_i2c_device_setup(gb_i2c_dev);
        if (ret)
@@ -282,7 +282,7 @@ out_err:
 
 static void gb_i2c_connection_exit(struct gb_connection *connection)
 {
-       struct gb_i2c_device *gb_i2c_dev = connection->private;
+       struct gb_i2c_device *gb_i2c_dev = gb_connection_get_data(connection);
 
        i2c_del_adapter(&gb_i2c_dev->adapter);
        /* kref_put(gb_i2c_dev->connection) */
index 47d4ac4533bc2fc0fd918388953085890282f553..8b71ed3df31833fb25ca7d790986abcde068550f 100644 (file)
@@ -1154,7 +1154,7 @@ static int gb_lights_request_handler(struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;
        struct device *dev = &connection->bundle->dev;
-       struct gb_lights *glights = connection->private;
+       struct gb_lights *glights = gb_connection_get_data(connection);
        struct gb_light *light;
        struct gb_message *request;
        struct gb_lights_event_request *payload;
@@ -1230,7 +1230,7 @@ static int gb_lights_probe(struct gb_bundle *bundle,
        }
 
        glights->connection = connection;
-       connection->private = glights;
+       gb_connection_set_data(connection, glights);
 
        mutex_init(&glights->lights_lock);
 
index ec8fb1b84024d27db66dcf411aef79a17a76c964..9cae396c61153eea0e7763bc90d8c4238ceb558b 100644 (file)
@@ -711,7 +711,7 @@ static int gb_power_supplies_register(struct gb_power_supplies *supplies)
 static int gb_supplies_request_handler(struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;
-       struct gb_power_supplies *supplies = connection->private;
+       struct gb_power_supplies *supplies = gb_connection_get_data(connection);
        struct gb_power_supply *gbpsy;
        struct gb_message *request;
        struct gb_power_supply_event_request *payload;
@@ -792,7 +792,7 @@ static int gb_power_supply_probe(struct gb_bundle *bundle,
        }
 
        supplies->connection = connection;
-       connection->private = supplies;
+       gb_connection_set_data(connection, supplies);
 
        mutex_init(&supplies->supplies_lock);
 
index 018d5c22907091a1eadc22ebfc9c80a418a41956..176301a498659e6a14ea6daec38fa558c965dbb2 100644 (file)
@@ -188,7 +188,7 @@ static int gb_pwm_connection_init(struct gb_connection *connection)
        if (!pwmc)
                return -ENOMEM;
        pwmc->connection = connection;
-       connection->private = pwmc;
+       gb_connection_set_data(connection, pwmc);
 
        /* Query number of pwms present */
        ret = gb_pwm_count_operation(pwmc);
@@ -218,8 +218,7 @@ out_err:
 
 static void gb_pwm_connection_exit(struct gb_connection *connection)
 {
-       struct gb_pwm_chip *pwmc = connection->private;
-
+       struct gb_pwm_chip *pwmc = gb_connection_get_data(connection);
        if (!pwmc)
                return;
 
index 9a20f0e0363dbcd48921d72ee335bf89b7ea8a14..d4cbcb972e94c7e875237fa689704a77b14f1389 100644 (file)
@@ -201,15 +201,14 @@ static int _gb_sdio_process_events(struct gb_sdio_host *host, u8 event)
 
 static int gb_sdio_event_recv(u8 type, struct gb_operation *op)
 {
-       struct gb_connection *connection = op->connection;
-       struct gb_sdio_host *host = connection->private;
+       struct gb_sdio_host *host = gb_connection_get_data(op->connection);
        struct gb_message *request;
        struct gb_sdio_event_request *payload;
        int ret =  0;
        u8 event;
 
        if (type != GB_SDIO_TYPE_EVENT) {
-               dev_err(&connection->bundle->dev,
+               dev_err(mmc_dev(host->mmc),
                        "unsupported unsolicited event: %u\n", type);
                return -EINVAL;
        }
@@ -723,7 +722,7 @@ static int gb_sdio_connection_init(struct gb_connection *connection)
        host->removed = true;
 
        host->connection = connection;
-       connection->private = host;
+       gb_connection_set_data(connection, host);
 
        ret = gb_sdio_get_caps(host);
        if (ret < 0)
@@ -767,7 +766,7 @@ free_work:
 free_buffer:
        kfree(host->xfer_buffer);
 free_mmc:
-       connection->private = NULL;
+       gb_connection_set_data(connection, NULL);
        mmc_free_host(mmc);
 
        return ret;
@@ -776,7 +775,7 @@ free_mmc:
 static void gb_sdio_connection_exit(struct gb_connection *connection)
 {
        struct mmc_host *mmc;
-       struct gb_sdio_host *host = connection->private;
+       struct gb_sdio_host *host = gb_connection_get_data(connection);
 
        if (!host)
                return;
@@ -784,7 +783,7 @@ static void gb_sdio_connection_exit(struct gb_connection *connection)
        mutex_lock(&host->lock);
        host->removed = true;
        mmc = host->mmc;
-       connection->private = NULL;
+       gb_connection_set_data(connection, NULL);
        mutex_unlock(&host->lock);
 
        flush_workqueue(host->mrq_workqueue);
index 35714533a1ac674dfa289bd6d6c84b0aec91996b..12e8cd8b16554870118ee80c49e97a0564be8edd 100644 (file)
@@ -28,7 +28,7 @@ struct gb_spi {
 
 static struct spi_master *get_master_from_spi(struct gb_spi *spi)
 {
-       return spi->connection->private;
+       return gb_connection_get_data(spi->connection);
 }
 
 static int tx_header_fit_operation(u32 tx_size, u32 count, size_t data_max)
@@ -339,7 +339,7 @@ static int gb_spi_connection_init(struct gb_connection *connection)
 
        spi = spi_master_get_devdata(master);
        spi->connection = connection;
-       connection->private = master;
+       gb_connection_set_data(connection, master);
 
        /* get master configuration */
        ret = gb_spi_get_master_config(spi);
@@ -382,7 +382,7 @@ out_put_master:
 
 static void gb_spi_connection_exit(struct gb_connection *connection)
 {
-       struct spi_master *master = connection->private;
+       struct spi_master *master = gb_connection_get_data(connection);
 
        spi_unregister_master(master);
 }
index ae1911ce24eff59a741fa86a8a4c1e14b36b60c8..6a8da0dd9f339e8233f85f082f1343f273f14959 100644 (file)
@@ -397,7 +397,7 @@ EXPORT_SYMBOL_GPL(gb_svc_ping);
 static int gb_svc_version_request(struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;
-       struct gb_svc *svc = connection->private;
+       struct gb_svc *svc = gb_connection_get_data(connection);
        struct gb_protocol_version_request *request;
        struct gb_protocol_version_response *response;
 
@@ -432,7 +432,7 @@ static int gb_svc_version_request(struct gb_operation *op)
 static int gb_svc_hello(struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;
-       struct gb_svc *svc = connection->private;
+       struct gb_svc *svc = gb_connection_get_data(connection);
        struct gb_svc_hello_request *hello_request;
        int ret;
 
@@ -550,7 +550,7 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation)
 {
        struct gb_svc_intf_hotplug_request *request;
        struct gb_connection *connection = operation->connection;
-       struct gb_svc *svc = connection->private;
+       struct gb_svc *svc = gb_connection_get_data(connection);
        struct gb_host_device *hd = connection->hd;
        struct gb_interface *intf;
        u8 intf_id;
@@ -644,7 +644,7 @@ out_interface_add:
 
 static void gb_svc_process_intf_hot_unplug(struct gb_operation *operation)
 {
-       struct gb_svc *svc = operation->connection->private;
+       struct gb_svc *svc = gb_connection_get_data(operation->connection);
        struct gb_svc_intf_hot_unplug_request *request;
        struct gb_host_device *hd = operation->connection->hd;
        struct gb_interface *intf;
@@ -675,7 +675,7 @@ static void gb_svc_process_deferred_request(struct work_struct *work)
 
        dr = container_of(work, struct gb_svc_deferred_request, work);
        operation = dr->operation;
-       svc = operation->connection->private;
+       svc = gb_connection_get_data(operation->connection);
        type = operation->request->header->type;
 
        switch (type) {
@@ -695,7 +695,7 @@ static void gb_svc_process_deferred_request(struct work_struct *work)
 
 static int gb_svc_queue_deferred_request(struct gb_operation *operation)
 {
-       struct gb_svc *svc = operation->connection->private;
+       struct gb_svc *svc = gb_connection_get_data(operation->connection);
        struct gb_svc_deferred_request *dr;
 
        dr = kmalloc(sizeof(*dr), GFP_KERNEL);
@@ -723,7 +723,7 @@ static int gb_svc_queue_deferred_request(struct gb_operation *operation)
  */
 static int gb_svc_intf_hotplug_recv(struct gb_operation *op)
 {
-       struct gb_svc *svc = op->connection->private;
+       struct gb_svc *svc = gb_connection_get_data(op->connection);
        struct gb_svc_intf_hotplug_request *request;
 
        if (op->request->payload_size < sizeof(*request)) {
@@ -741,7 +741,7 @@ static int gb_svc_intf_hotplug_recv(struct gb_operation *op)
 
 static int gb_svc_intf_hot_unplug_recv(struct gb_operation *op)
 {
-       struct gb_svc *svc = op->connection->private;
+       struct gb_svc *svc = gb_connection_get_data(op->connection);
        struct gb_svc_intf_hot_unplug_request *request;
 
        if (op->request->payload_size < sizeof(*request)) {
@@ -759,7 +759,7 @@ static int gb_svc_intf_hot_unplug_recv(struct gb_operation *op)
 
 static int gb_svc_intf_reset_recv(struct gb_operation *op)
 {
-       struct gb_svc *svc = op->connection->private;
+       struct gb_svc *svc = gb_connection_get_data(op->connection);
        struct gb_message *request = op->request;
        struct gb_svc_intf_reset_request *reset;
        u8 intf_id;
@@ -794,7 +794,7 @@ static int gb_svc_key_code_map(struct gb_svc *svc, u16 key_code, u16 *code)
 
 static int gb_svc_key_event_recv(struct gb_operation *op)
 {
-       struct gb_svc *svc = op->connection->private;
+       struct gb_svc *svc = gb_connection_get_data(op->connection);
        struct gb_message *request = op->request;
        struct gb_svc_key_event_request *key;
        u16 code;
@@ -828,7 +828,7 @@ static int gb_svc_key_event_recv(struct gb_operation *op)
 static int gb_svc_request_handler(struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;
-       struct gb_svc *svc = connection->private;
+       struct gb_svc *svc = gb_connection_get_data(connection);
        u8 type = op->type;
        int ret = 0;
 
@@ -975,7 +975,7 @@ struct gb_svc *gb_svc_create(struct gb_host_device *hd)
                goto err_free_input;
        }
 
-       svc->connection->private = svc;
+       gb_connection_set_data(svc->connection, svc);
 
        return svc;
 
index d169c55b455258da2122bcad46b8ad98d8e22e8c..c580fe06f55489b1e18292238d12d884e5352979 100644 (file)
@@ -69,7 +69,7 @@ static atomic_t reference_count = ATOMIC_INIT(0);
 static int gb_uart_receive_data_handler(struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;
-       struct gb_tty *gb_tty = connection->private;
+       struct gb_tty *gb_tty = gb_connection_get_data(connection);
        struct tty_port *port = &gb_tty->port;
        struct gb_message *request = op->request;
        struct gb_uart_recv_data_request *receive_data;
@@ -125,7 +125,7 @@ static int gb_uart_receive_data_handler(struct gb_operation *op)
 static int gb_uart_serial_state_handler(struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;
-       struct gb_tty *gb_tty = connection->private;
+       struct gb_tty *gb_tty = gb_connection_get_data(connection);
        struct gb_message *request = op->request;
        struct gb_uart_serial_state_request *serial_state;
 
@@ -658,7 +658,7 @@ static int gb_uart_connection_init(struct gb_connection *connection)
        }
 
        gb_tty->connection = connection;
-       connection->private = gb_tty;
+       gb_connection_set_data(connection, gb_tty);
 
        minor = alloc_minor(gb_tty);
        if (minor < 0) {
@@ -702,7 +702,7 @@ error:
        tty_port_destroy(&gb_tty->port);
        release_minor(gb_tty);
 error_minor:
-       connection->private = NULL;
+       gb_connection_set_data(connection, NULL);
        kfree(gb_tty->buffer);
 error_payload:
        kfree(gb_tty);
@@ -714,7 +714,7 @@ error_alloc:
 
 static void gb_uart_connection_exit(struct gb_connection *connection)
 {
-       struct gb_tty *gb_tty = connection->private;
+       struct gb_tty *gb_tty = gb_connection_get_data(connection);
        struct tty_struct *tty;
 
        if (!gb_tty)
@@ -724,7 +724,7 @@ static void gb_uart_connection_exit(struct gb_connection *connection)
        gb_tty->disconnected = true;
 
        wake_up_all(&gb_tty->wioctl);
-       connection->private = NULL;
+       gb_connection_set_data(connection, NULL);
        mutex_unlock(&gb_tty->mutex);
 
        tty = tty_port_tty_get(&gb_tty->port);
index 0cfc00f39b462ba2f23d48a8dc55e72a72feb367..25a6c7e5e5ba5a1c2d7f5794b1624a2b00b9f9f7 100644 (file)
@@ -176,7 +176,7 @@ static int gb_usb_connection_init(struct gb_connection *connection)
 
        gb_usb_dev = to_gb_usb_device(hcd);
        gb_usb_dev->connection = connection;
-       connection->private = gb_usb_dev;
+       gb_connection_set_data(connection, gb_usb_dev);
 
        hcd->has_tt = 1;
 
@@ -206,7 +206,7 @@ err_put_hcd:
 
 static void gb_usb_connection_exit(struct gb_connection *connection)
 {
-       struct gb_usb_device *gb_usb_dev = connection->private;
+       struct gb_usb_device *gb_usb_dev = gb_connection_get_data(connection);
        struct usb_hcd *hcd = gb_usb_device_to_hcd(gb_usb_dev);
 
        usb_remove_hcd(hcd);
index 8c0df99b9f8dca205b403fd4685b5a57ad051472..5afcb2784a32643a8823dde0c50246e67060aee1 100644 (file)
@@ -114,7 +114,7 @@ static int gb_vibrator_probe(struct gb_bundle *bundle,
                retval = PTR_ERR(connection);
                goto err_free_vib;
        }
-       connection->private = vib;
+       gb_connection_set_data(connection, vib);
 
        vib->connection = connection;