From: Greg Kroah-Hartman Date: Tue, 22 Mar 2016 18:30:35 +0000 (-0400) Subject: greybus: convert drivers to use connection->private set/get X-Git-Tag: Ubuntu-4.10.0-19.21~2488^2~378^2~21^2~573 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=0ec306324423444d3ee0222708ef9de7f5586b93;p=mirror_ubuntu-artful-kernel.git greybus: convert drivers to use connection->private set/get 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 Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index 025dd53507b7..30b381ab8a1f 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -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; diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index 722f2b4fe54d..a871b0f33733 100644 --- a/drivers/staging/greybus/camera.c +++ b/drivers/staging/greybus/camera.c @@ -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); diff --git a/drivers/staging/greybus/control.c b/drivers/staging/greybus/control.c index bac412ef72ab..83be255bb534 100644 --- a/drivers/staging/greybus/control.c +++ b/drivers/staging/greybus/control.c @@ -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; } diff --git a/drivers/staging/greybus/firmware.c b/drivers/staging/greybus/firmware.c index 17ce573b9162..b1188b23ffe5 100644 --- a/drivers/staging/greybus/firmware.c +++ b/drivers/staging/greybus/firmware.c @@ -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; diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c index 7b2cb5d81e54..440ff44c8524 100644 --- a/drivers/staging/greybus/gpio.c +++ b/drivers/staging/greybus/gpio.c @@ -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; diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c index 6ef151f61ffc..fd4a7e096450 100644 --- a/drivers/staging/greybus/hid.c +++ b/drivers/staging/greybus/hid.c @@ -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(); diff --git a/drivers/staging/greybus/i2c.c b/drivers/staging/greybus/i2c.c index 4b96f69318bd..73b85815d1eb 100644 --- a/drivers/staging/greybus/i2c.c +++ b/drivers/staging/greybus/i2c.c @@ -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) */ diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c index 47d4ac4533bc..8b71ed3df318 100644 --- a/drivers/staging/greybus/light.c +++ b/drivers/staging/greybus/light.c @@ -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); diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c index ec8fb1b84024..9cae396c6115 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -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); diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c index 018d5c229070..176301a49865 100644 --- a/drivers/staging/greybus/pwm.c +++ b/drivers/staging/greybus/pwm.c @@ -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; diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c index 9a20f0e0363d..d4cbcb972e94 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -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); diff --git a/drivers/staging/greybus/spi.c b/drivers/staging/greybus/spi.c index 35714533a1ac..12e8cd8b1655 100644 --- a/drivers/staging/greybus/spi.c +++ b/drivers/staging/greybus/spi.c @@ -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); } diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index ae1911ce24ef..6a8da0dd9f33 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -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; diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index d169c55b4552..c580fe06f554 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -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); diff --git a/drivers/staging/greybus/usb.c b/drivers/staging/greybus/usb.c index 0cfc00f39b46..25a6c7e5e5ba 100644 --- a/drivers/staging/greybus/usb.c +++ b/drivers/staging/greybus/usb.c @@ -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); diff --git a/drivers/staging/greybus/vibrator.c b/drivers/staging/greybus/vibrator.c index 8c0df99b9f8d..5afcb2784a32 100644 --- a/drivers/staging/greybus/vibrator.c +++ b/drivers/staging/greybus/vibrator.c @@ -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;