Re: [PATCH] staging: greybus: audio: Rename cport with intf_id

From: Vaibhav Agarwal
Date: Sun Oct 16 2016 - 23:29:49 EST


On Sun, Oct 16, 2016 at 3:29 PM, Pankaj Bharadiya
<pankaj.bharadiya@xxxxxxxxx> wrote:
> gb_audio_manager_module_descriptor's cport field is actually used to
> manage and pass interface id to user space.
>
> Thus rename gb_audio_manager_module_descriptor's 'cport' field and
> few other things to avoid confusion.
>
> Signed-off-by: Pankaj Bharadiya <pankaj.bharadiya@xxxxxxxxx>
> ---
> drivers/staging/greybus/audio_manager.h | 2 +-
> drivers/staging/greybus/audio_manager_module.c | 20 ++++++++++----------
> drivers/staging/greybus/audio_manager_sysfs.c | 4 ++--
> drivers/staging/greybus/audio_module.c | 2 +-
> 4 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_manager.h b/drivers/staging/greybus/audio_manager.h
> index c4ca097..056088e 100644
> --- a/drivers/staging/greybus/audio_manager.h
> +++ b/drivers/staging/greybus/audio_manager.h
> @@ -21,7 +21,7 @@ struct gb_audio_manager_module_descriptor {
> 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 a10e96a..2bf40a9 100644
> --- a/drivers/staging/greybus/audio_manager_module.c
> +++ b/drivers/staging/greybus/audio_manager_module.c
> @@ -111,16 +111,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,
> @@ -149,7 +149,7 @@ static ssize_t gb_audio_module_op_devices_show(
> &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 */
> @@ -167,7 +167,7 @@ static void send_add_uevent(struct gb_audio_manager_module *module)
> 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];
>
> @@ -176,7 +176,7 @@ static void send_add_uevent(struct gb_audio_manager_module *module)
> slot_string,
> vid_string,
> pid_string,
> - cport_string,
> + intf_id_string,
> ip_devices_string,
> op_devices_string,
> NULL
> @@ -186,7 +186,7 @@ static void send_add_uevent(struct gb_audio_manager_module *module)
> 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 +246,13 @@ 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 slot=%d 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 d8bf859..feb195d 100644
> --- a/drivers/staging/greybus/audio_manager_sysfs.c
> +++ b/drivers/staging/greybus/audio_manager_sysfs.c
> @@ -20,10 +20,10 @@ 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"
> + "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.cport, &desc.ip_devices, &desc.op_devices);
> + &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 ae1c0fa..45b2519 100644
> --- a/drivers/staging/greybus/audio_module.c
> +++ b/drivers/staging/greybus/audio_module.c
> @@ -348,7 +348,7 @@ static int gb_audio_probe(struct gb_bundle *bundle,
> 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);
> --
> 1.9.1
>
Reviewed-by: Vaibhav Agarwal <vaibhav.sr@xxxxxxxxx>