diff options
Diffstat (limited to 'drivers/staging/greybus')
-rw-r--r-- | drivers/staging/greybus/arche-apb-ctrl.c | 8 | ||||
-rw-r--r-- | drivers/staging/greybus/arche-platform.c | 3 | ||||
-rw-r--r-- | drivers/staging/greybus/audio_codec.c | 5 | ||||
-rw-r--r-- | drivers/staging/greybus/audio_codec.h | 1 | ||||
-rw-r--r-- | drivers/staging/greybus/audio_manager.h | 3 | ||||
-rw-r--r-- | drivers/staging/greybus/audio_manager_module.c | 35 | ||||
-rw-r--r-- | drivers/staging/greybus/audio_manager_sysfs.c | 16 | ||||
-rw-r--r-- | drivers/staging/greybus/audio_module.c | 7 | ||||
-rw-r--r-- | drivers/staging/greybus/audio_topology.c | 8 | ||||
-rw-r--r-- | drivers/staging/greybus/camera.c | 7 | ||||
-rw-r--r-- | drivers/staging/greybus/es2.c | 5 | ||||
-rw-r--r-- | drivers/staging/greybus/log.c | 6 | ||||
-rw-r--r-- | drivers/staging/greybus/sdio.c | 3 | ||||
-rw-r--r-- | drivers/staging/greybus/timesync.c | 6 | ||||
-rw-r--r-- | drivers/staging/greybus/uart.c | 36 |
15 files changed, 64 insertions, 85 deletions
diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c index 70323aa11f24..3fda0cd6bb42 100644 --- a/drivers/staging/greybus/arche-apb-ctrl.c +++ b/drivers/staging/greybus/arche-apb-ctrl.c @@ -183,7 +183,7 @@ static int standby_boot_seq(struct platform_device *pdev) * Pasted from WDM spec, * - A falling edge on POWEROFF_L is detected (a) * - WDM enters standby mode, but no output signals are changed - * */ + */ /* TODO: POWEROFF_L is input to WDM module */ apb->state = ARCHE_PLATFORM_STATE_STANDBY; @@ -285,8 +285,10 @@ static ssize_t state_store(struct device *dev, if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING) return count; - /* First we want to make sure we power off everything - * and then enter FW flashing state */ + /* + * First we want to make sure we power off everything + * and then enter FW flashing state + */ poweroff_seq(pdev); ret = fw_flashing_seq(pdev); } else { diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c index d33d6fe078ad..338c2d3ee842 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -457,7 +457,8 @@ retry: goto exit; /* First we want to make sure we power off everything - * and then activate back again */ + * and then activate back again + */ device_for_each_child(arche_pdata->dev, NULL, apb_poweroff); arche_platform_poweroff_seq(arche_pdata); diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index 8a0744b58a32..f8862c6d7102 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -405,7 +405,6 @@ static void gbcodec_shutdown(struct snd_pcm_substream *substream, params->state = GBAUDIO_CODEC_SHUTDOWN; mutex_unlock(&codec->lock); pm_relax(dai->dev); - return; } static int gbcodec_hw_params(struct snd_pcm_substream *substream, @@ -655,8 +654,10 @@ static int gbcodec_mute_stream(struct snd_soc_dai *dai, int mute, int stream) ret = gb_audio_apbridgea_shutdown_rx(data->connection, 0); params->state = GBAUDIO_CODEC_STOP; - } else + } else { ret = -EINVAL; + } + if (ret) dev_err_ratelimited(dai->dev, "%s:Error during %s %s stream:%d\n", diff --git a/drivers/staging/greybus/audio_codec.h b/drivers/staging/greybus/audio_codec.h index ca027bd99ad7..62fd93939a1f 100644 --- a/drivers/staging/greybus/audio_codec.h +++ b/drivers/staging/greybus/audio_codec.h @@ -158,7 +158,6 @@ struct gbaudio_module_info { int dev_id; /* check if it should be bundle_id/hd_cport_id */ int vid; int pid; - int slot; int type; int set_uevent; char vstr[NAME_SIZE]; diff --git a/drivers/staging/greybus/audio_manager.h b/drivers/staging/greybus/audio_manager.h index c4ca09754a6a..5ab8f5e0ed3f 100644 --- a/drivers/staging/greybus/audio_manager.h +++ b/drivers/staging/greybus/audio_manager.h @@ -18,10 +18,9 @@ struct gb_audio_manager_module_descriptor { char name[GB_AUDIO_MANAGER_MODULE_NAME_LEN]; - int slot; int vid; int pid; - int cport; + int intf_id; unsigned int ip_devices; unsigned int op_devices; }; diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c index a10e96ad79c1..adc16977452d 100644 --- a/drivers/staging/greybus/audio_manager_module.c +++ b/drivers/staging/greybus/audio_manager_module.c @@ -81,16 +81,6 @@ static ssize_t gb_audio_module_name_show( static struct gb_audio_manager_module_attribute gb_audio_module_name_attribute = __ATTR(name, 0664, gb_audio_module_name_show, NULL); -static ssize_t gb_audio_module_slot_show( - struct gb_audio_manager_module *module, - struct gb_audio_manager_module_attribute *attr, char *buf) -{ - return sprintf(buf, "%d", module->desc.slot); -} - -static struct gb_audio_manager_module_attribute gb_audio_module_slot_attribute = - __ATTR(slot, 0664, gb_audio_module_slot_show, NULL); - static ssize_t gb_audio_module_vid_show( struct gb_audio_manager_module *module, struct gb_audio_manager_module_attribute *attr, char *buf) @@ -111,16 +101,16 @@ static ssize_t gb_audio_module_pid_show( static struct gb_audio_manager_module_attribute gb_audio_module_pid_attribute = __ATTR(pid, 0664, gb_audio_module_pid_show, NULL); -static ssize_t gb_audio_module_cport_show( +static ssize_t gb_audio_module_intf_id_show( struct gb_audio_manager_module *module, struct gb_audio_manager_module_attribute *attr, char *buf) { - return sprintf(buf, "%d", module->desc.cport); + return sprintf(buf, "%d", module->desc.intf_id); } static struct gb_audio_manager_module_attribute - gb_audio_module_cport_attribute = - __ATTR(cport, 0664, gb_audio_module_cport_show, NULL); + gb_audio_module_intf_id_attribute = + __ATTR(intf_id, 0664, gb_audio_module_intf_id_show, NULL); static ssize_t gb_audio_module_ip_devices_show( struct gb_audio_manager_module *module, @@ -146,10 +136,9 @@ static struct gb_audio_manager_module_attribute static struct attribute *gb_audio_module_default_attrs[] = { &gb_audio_module_name_attribute.attr, - &gb_audio_module_slot_attribute.attr, &gb_audio_module_vid_attribute.attr, &gb_audio_module_pid_attribute.attr, - &gb_audio_module_cport_attribute.attr, + &gb_audio_module_intf_id_attribute.attr, &gb_audio_module_ip_devices_attribute.attr, &gb_audio_module_op_devices_attribute.attr, NULL, /* need to NULL terminate the list of attributes */ @@ -164,29 +153,26 @@ static struct kobj_type gb_audio_module_type = { static void send_add_uevent(struct gb_audio_manager_module *module) { char name_string[128]; - char slot_string[64]; char vid_string[64]; char pid_string[64]; - char cport_string[64]; + char intf_id_string[64]; char ip_devices_string[64]; char op_devices_string[64]; char *envp[] = { name_string, - slot_string, vid_string, pid_string, - cport_string, + intf_id_string, ip_devices_string, op_devices_string, NULL }; snprintf(name_string, 128, "NAME=%s", module->desc.name); - snprintf(slot_string, 64, "SLOT=%d", module->desc.slot); snprintf(vid_string, 64, "VID=%d", module->desc.vid); snprintf(pid_string, 64, "PID=%d", module->desc.pid); - snprintf(cport_string, 64, "CPORT=%d", module->desc.cport); + snprintf(intf_id_string, 64, "INTF_ID=%d", module->desc.intf_id); snprintf(ip_devices_string, 64, "I/P DEVICES=0x%X", module->desc.ip_devices); snprintf(op_devices_string, 64, "O/P DEVICES=0x%X", @@ -246,13 +232,12 @@ int gb_audio_manager_module_create( void gb_audio_manager_module_dump(struct gb_audio_manager_module *module) { - pr_info("audio module #%d name=%s slot=%d vid=%d pid=%d cport=%d i/p devices=0x%X o/p devices=0x%X\n", + pr_info("audio module #%d name=%s vid=%d pid=%d intf_id=%d i/p devices=0x%X o/p devices=0x%X\n", module->id, module->desc.name, - module->desc.slot, module->desc.vid, module->desc.pid, - module->desc.cport, + module->desc.intf_id, module->desc.ip_devices, module->desc.op_devices); } diff --git a/drivers/staging/greybus/audio_manager_sysfs.c b/drivers/staging/greybus/audio_manager_sysfs.c index d8bf8591ff9e..34ebd147052f 100644 --- a/drivers/staging/greybus/audio_manager_sysfs.c +++ b/drivers/staging/greybus/audio_manager_sysfs.c @@ -20,10 +20,9 @@ static ssize_t manager_sysfs_add_store( int num = sscanf(buf, "name=%" GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "s " - "slot=%d vid=%d pid=%d cport=%d i/p devices=0x%X" - "o/p devices=0x%X", - desc.name, &desc.slot, &desc.vid, &desc.pid, - &desc.cport, &desc.ip_devices, &desc.op_devices); + "vid=%d pid=%d intf_id=%d i/p devices=0x%X o/p devices=0x%X", + desc.name, &desc.vid, &desc.pid, &desc.intf_id, + &desc.ip_devices, &desc.op_devices); if (num != 7) return -EINVAL; @@ -44,7 +43,7 @@ static ssize_t manager_sysfs_remove_store( { int id; - int num = sscanf(buf, "%d", &id); + int num = kstrtoint(buf, 10, &id); if (num != 1) return -EINVAL; @@ -65,16 +64,17 @@ static ssize_t manager_sysfs_dump_store( { int id; - int num = sscanf(buf, "%d", &id); + int num = kstrtoint(buf, 10, &id); if (num == 1) { num = gb_audio_manager_dump_module(id); if (num) return num; - } else if (!strncmp("all", buf, 3)) + } else if (!strncmp("all", buf, 3)) { gb_audio_manager_dump_all(); - else + } else { return -EINVAL; + } return count; } diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c index ae1c0fa85752..17a9948b1ba1 100644 --- a/drivers/staging/greybus/audio_module.c +++ b/drivers/staging/greybus/audio_module.c @@ -207,10 +207,8 @@ static int gb_audio_add_data_connection(struct gbaudio_module_info *gbmodule, struct gbaudio_data_connection *dai; dai = devm_kzalloc(gbmodule->dev, sizeof(*dai), GFP_KERNEL); - if (!dai) { - dev_err(gbmodule->dev, "DAI Malloc failure\n"); + if (!dai) return -ENOMEM; - } connection = gb_connection_create_offloaded(bundle, le16_to_cpu(cport_desc->id), @@ -345,10 +343,9 @@ static int gb_audio_probe(struct gb_bundle *bundle, dev_dbg(dev, "Inform set_event:%d to above layer\n", 1); /* prepare for the audio manager */ strlcpy(desc.name, gbmodule->name, GB_AUDIO_MANAGER_MODULE_NAME_LEN); - desc.slot = 1; /* todo */ desc.vid = 2; /* todo */ desc.pid = 3; /* todo */ - desc.cport = gbmodule->dev_id; + desc.intf_id = gbmodule->dev_id; desc.op_devices = gbmodule->op_devices; desc.ip_devices = gbmodule->ip_devices; gbmodule->manager_id = gb_audio_manager_add(&desc); diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c index b6251691a33d..8b216ca99cf9 100644 --- a/drivers/staging/greybus/audio_topology.c +++ b/drivers/staging/greybus/audio_topology.c @@ -114,6 +114,7 @@ static int gbaudio_map_widgetname(struct gbaudio_module_info *module, const char *name) { struct gbaudio_widget *widget; + list_for_each_entry(widget, &module->widget_list, list) { if (!strncmp(widget->name, name, NAME_SIZE)) return widget->id; @@ -1044,8 +1045,10 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module, control->texts = (const char * const *) gb_generate_enum_strings(module, gbenum); control->items = gbenum->items; - } else + } else { csize = sizeof(struct gb_audio_control); + } + *w_size += csize; curr = (void *)curr + csize; list_add(&control->list, &module->widget_ctl_list); @@ -1190,8 +1193,9 @@ static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module, control->texts = (const char * const *) gb_generate_enum_strings(module, gbenum); control->items = gbenum->items; - } else + } else { csize = sizeof(struct gb_audio_control); + } list_add(&control->list, &module->ctl_list); dev_dbg(module->dev, "%d:%s created of type %d\n", curr->id, diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index cebb76e7d55c..0ee291ca2c72 100644 --- a/drivers/staging/greybus/camera.c +++ b/drivers/staging/greybus/camera.c @@ -289,6 +289,7 @@ static const int gb_camera_configure_streams_validate_response( for (i = 0; i < resp->num_streams; i++) { struct gb_camera_stream_config_response *cfg = &resp->config[i]; + if (cfg->padding) { gcam_err(gcam, "stream #%u padding != 0\n", i); return -EIO; @@ -796,7 +797,7 @@ static int gb_camera_op_configure_streams(void *priv, unsigned int *nstreams, if (gb_nstreams > GB_CAMERA_MAX_STREAMS) return -EINVAL; - gb_streams = kzalloc(gb_nstreams * sizeof(*gb_streams), GFP_KERNEL); + gb_streams = kcalloc(gb_nstreams, sizeof(*gb_streams), GFP_KERNEL); if (!gb_streams) return -ENOMEM; @@ -937,7 +938,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam, return ret; /* For each stream to configure parse width, height and format */ - streams = kzalloc(nstreams * sizeof(*streams), GFP_KERNEL); + streams = kcalloc(nstreams, sizeof(*streams), GFP_KERNEL); if (!streams) return -ENOMEM; @@ -1118,7 +1119,7 @@ static ssize_t gb_camera_debugfs_write(struct file *file, char *kbuf; if (len > 1024) - return -EINVAL; + return -EINVAL; kbuf = kmalloc(len + 1, GFP_KERNEL); if (!kbuf) diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c index d367cdffaa10..c1929dfa9b31 100644 --- a/drivers/staging/greybus/es2.c +++ b/drivers/staging/greybus/es2.c @@ -175,10 +175,9 @@ static int output_sync(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd) u8 *data; int retval; - data = kmalloc(size, GFP_KERNEL); + data = kmemdup(req, size, GFP_KERNEL); if (!data) return -ENOMEM; - memcpy(data, req, size); retval = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), cmd, @@ -1034,7 +1033,7 @@ static struct arpc *arpc_alloc(void *payload, u16 size, u8 type) goto err_free_req; rpc->req->type = type; - rpc->req->size = cpu_to_le16(sizeof(rpc->req) + size); + rpc->req->size = cpu_to_le16(sizeof(*rpc->req) + size); memcpy(rpc->req->data, payload, size); init_completion(&rpc->response_received); diff --git a/drivers/staging/greybus/log.c b/drivers/staging/greybus/log.c index 70dd9e5a1cf2..1a18ab1ff8aa 100644 --- a/drivers/staging/greybus/log.c +++ b/drivers/staging/greybus/log.c @@ -55,8 +55,10 @@ static int gb_log_request_handler(struct gb_operation *op) /* Ensure the buffer is 0 terminated */ receive->msg[len - 1] = '\0'; - /* Print with dev_dbg() so that it can be easily turned off using - * dynamic debugging (and prevent any DoS) */ + /* + * Print with dev_dbg() so that it can be easily turned off using + * dynamic debugging (and prevent any DoS) + */ dev_dbg(dev, "%s", receive->msg); return 0; diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c index 5649ef1e379d..66b37ea29ef0 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -191,9 +191,8 @@ static int _gb_sdio_process_events(struct gb_sdio_host *host, u8 event) state_changed = 1; } - if (event & GB_SDIO_WP) { + if (event & GB_SDIO_WP) host->read_only = true; - } if (state_changed) { dev_info(mmc_dev(host->mmc), "card %s now event\n", diff --git a/drivers/staging/greybus/timesync.c b/drivers/staging/greybus/timesync.c index 09ce00484b3f..29e6c1c12807 100644 --- a/drivers/staging/greybus/timesync.c +++ b/drivers/staging/greybus/timesync.c @@ -807,11 +807,11 @@ static int gb_timesync_schedule(struct gb_timesync_svc *timesync_svc, int state) return -EINVAL; mutex_lock(×ync_svc->mutex); - if (timesync_svc->state != GB_TIMESYNC_STATE_INVALID) { + if (timesync_svc->state != GB_TIMESYNC_STATE_INVALID) gb_timesync_set_state_atomic(timesync_svc, state); - } else { + else ret = -ENODEV; - } + mutex_unlock(×ync_svc->mutex); return ret; } diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index 2633d2bfb1b4..6d39f4a04754 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -623,9 +623,6 @@ static int get_serial_info(struct gb_tty *gb_tty, { struct serial_struct tmp; - if (!info) - return -EINVAL; - memset(&tmp, 0, sizeof(tmp)); tmp.flags = ASYNC_LOW_LATENCY | ASYNC_SKIP_TEST; tmp.type = PORT_16550A; @@ -711,25 +708,20 @@ static int wait_serial_change(struct gb_tty *gb_tty, unsigned long arg) return retval; } -static int get_serial_usage(struct gb_tty *gb_tty, - struct serial_icounter_struct __user *count) +static int gb_tty_get_icount(struct tty_struct *tty, + struct serial_icounter_struct *icount) { - struct serial_icounter_struct icount; - int retval = 0; - - memset(&icount, 0, sizeof(icount)); - icount.dsr = gb_tty->iocount.dsr; - icount.rng = gb_tty->iocount.rng; - icount.dcd = gb_tty->iocount.dcd; - icount.frame = gb_tty->iocount.frame; - icount.overrun = gb_tty->iocount.overrun; - icount.parity = gb_tty->iocount.parity; - icount.brk = gb_tty->iocount.brk; + struct gb_tty *gb_tty = tty->driver_data; - if (copy_to_user(count, &icount, sizeof(icount)) > 0) - retval = -EFAULT; + icount->dsr = gb_tty->iocount.dsr; + icount->rng = gb_tty->iocount.rng; + icount->dcd = gb_tty->iocount.dcd; + icount->frame = gb_tty->iocount.frame; + icount->overrun = gb_tty->iocount.overrun; + icount->parity = gb_tty->iocount.parity; + icount->brk = gb_tty->iocount.brk; - return retval; + return 0; } static int gb_tty_ioctl(struct tty_struct *tty, unsigned int cmd, @@ -746,9 +738,6 @@ static int gb_tty_ioctl(struct tty_struct *tty, unsigned int cmd, (struct serial_struct __user *)arg); case TIOCMIWAIT: return wait_serial_change(gb_tty, arg); - case TIOCGICOUNT: - return get_serial_usage(gb_tty, - (struct serial_icounter_struct __user *)arg); } return -ENOIOCTLCMD; @@ -830,9 +819,10 @@ static const struct tty_operations gb_ops = { .set_termios = gb_tty_set_termios, .tiocmget = gb_tty_tiocmget, .tiocmset = gb_tty_tiocmset, + .get_icount = gb_tty_get_icount, }; -static struct tty_port_operations gb_port_ops = { +static const struct tty_port_operations gb_port_ops = { .dtr_rts = gb_tty_dtr_rts, .activate = gb_tty_port_activate, .shutdown = gb_tty_port_shutdown, |