Re: [PATCH 3/3] soundwire: add Slave sysfs support

From: Vinod Koul
Date: Wed May 20 2020 - 07:57:13 EST


On 19-05-20, 04:35, Bard Liao wrote:

> +int sdw_slave_sysfs_init(struct sdw_slave *slave)
> +{
> + int ret;
> +
> + ret = devm_device_add_groups(&slave->dev, slave_groups);
> + if (ret < 0)
> + return ret;
> +
> + ret = devm_device_add_group(&slave->dev, &sdw_slave_dev_attr_group);
> + if (ret < 0)
> + return ret;
> +
> + if (slave->prop.dp0_prop) {
> + ret = devm_device_add_group(&slave->dev, &dp0_group);
> + if (ret < 0)
> + return ret;
> + }
> +
> + if (slave->prop.source_ports || slave->prop.sink_ports) {
> + ret = sdw_slave_sysfs_dpn_init(slave);
> + if (ret < 0)
> + return ret;
> + }
> +
> + return 0;
> +}
> +

We have trailing line here

> +static int add_all_attributes(struct device *dev, int N, int dir)
> +{
> + struct attribute **dpn_attrs;
> + struct attribute_group *dpn_group;
> + int i = 0;
> + int ret;
> +
> + /* allocate attributes, last one is NULL */
> + dpn_attrs = devm_kcalloc(dev, SDW_DPN_ATTRIBUTES + 1,
> + sizeof(struct attribute *),
> + GFP_KERNEL);
> + if (!dpn_attrs)
> + return -ENOMEM;
> +
> + ret = max_word_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = min_word_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = words_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = type_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = max_grouping_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = simple_ch_prep_sm_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = ch_prep_timeout_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = imp_def_interrupts_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "0x%x\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = min_ch_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = max_ch_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = channels_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = ch_combinations_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = max_async_buffer_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = block_pack_mode_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + ret = port_encoding_attribute_alloc(dev, &dpn_attrs[i++],
> + N, dir, "%d\n");
> + if (ret < 0)
> + return ret;
> +
> + /* paranioa check for editing mistakes */

s/paranioa/paranoia

I found only these two nitpicks so I will go ahead and apply these and
fix them up.

--
~Vinod