Re: [PATCH] staging: greybus: audio: remove redundant slot field

From: Vaibhav Agarwal
Date: Mon Oct 17 2016 - 05:29:53 EST


On Mon, Oct 17, 2016 at 2:42 PM, Pankaj Bharadiya
<pankaj.bharadiya@xxxxxxxxx> wrote:
> gb_audio_manager_module_descriptor's intf_id field maintains the
> information about the interface on which module is connected hence
> having an extra slot field is redundant.
>
> Thus remove the slot field and its associated code.
>
> Signed-off-by: Pankaj Bharadiya <pankaj.bharadiya@xxxxxxxxx>
> ---
> drivers/staging/greybus/audio_codec.h | 1 -
> drivers/staging/greybus/audio_manager.h | 1 -
> drivers/staging/greybus/audio_manager_module.c | 17 +----------------
> drivers/staging/greybus/audio_manager_sysfs.c | 7 +++----
> drivers/staging/greybus/audio_module.c | 1 -
> 5 files changed, 4 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_codec.h b/drivers/staging/greybus/audio_codec.h
> index ca027bd..62fd939 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 056088e..5ab8f5e 100644
> --- a/drivers/staging/greybus/audio_manager.h
> +++ b/drivers/staging/greybus/audio_manager.h
> @@ -18,7 +18,6 @@
>
> struct gb_audio_manager_module_descriptor {
> char name[GB_AUDIO_MANAGER_MODULE_NAME_LEN];
> - int slot;
> int vid;
> int pid;
> int intf_id;
> diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c
> index 2bf40a9..adc1697 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)
> @@ -146,7 +136,6 @@ static ssize_t gb_audio_module_op_devices_show(
>
> 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_intf_id_attribute.attr,
> @@ -164,7 +153,6 @@ static ssize_t gb_audio_module_op_devices_show(
> 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 intf_id_string[64];
> @@ -173,7 +161,6 @@ static void send_add_uevent(struct gb_audio_manager_module *module)
>
> char *envp[] = {
> name_string,
> - slot_string,
> vid_string,
> pid_string,
> intf_id_string,
> @@ -183,7 +170,6 @@ static void send_add_uevent(struct gb_audio_manager_module *module)
> };
>
> 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(intf_id_string, 64, "INTF_ID=%d", module->desc.intf_id);
> @@ -246,10 +232,9 @@ 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 intf_id=%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.intf_id,
> diff --git a/drivers/staging/greybus/audio_manager_sysfs.c b/drivers/staging/greybus/audio_manager_sysfs.c
> index fc0aca6..9eae70f 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 intf_id=%d i/p devices=0x%X"
> - "o/p devices=0x%X",
> - desc.name, &desc.slot, &desc.vid, &desc.pid,
> - &desc.intf_id, &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;
> diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c
> index 45b2519..0269a1d 100644
> --- a/drivers/staging/greybus/audio_module.c
> +++ b/drivers/staging/greybus/audio_module.c
> @@ -345,7 +345,6 @@ 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.intf_id = gbmodule->dev_id;
> --
> 1.9.1
>
Reviewed-by: Vaibhav Agarwal <vaibhav.sr@xxxxxxxxx>