[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0290d80b-08fc-d85f-3f9b-fea41d3df3a8@linux.intel.com>
Date: Mon, 4 Nov 2019 13:41:46 -0600
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: Cezary Rojewski <cezary.rojewski@...el.com>
Cc: alsa-devel@...a-project.org, tiwai@...e.de,
gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
vkoul@...nel.org, broonie@...nel.org,
srinivas.kandagatla@...aro.org, jank@...ence.com,
slawomir.blauciak@...el.com, Sanyog Kale <sanyog.r.kale@...el.com>,
Bard liao <yung-chuan.liao@...ux.intel.com>,
Rander Wang <rander.wang@...ux.intel.com>
Subject: Re: [alsa-devel] [PATCH 06/14] soundwire: add support for
sdw_slave_type
>> @@ -49,9 +49,16 @@ int sdw_slave_modalias(const struct sdw_slave
>> *slave, char *buf, size_t size)
>> static int sdw_uevent(struct device *dev, struct kobj_uevent_env *env)
>> {
>> - struct sdw_slave *slave = to_sdw_slave_device(dev);
>> + struct sdw_slave *slave;
>> char modalias[32];
>> + if (is_sdw_slave(dev)) {
>> + slave = to_sdw_slave_device(dev);
>> + } else {
>> + dev_warn(dev, "uevent for unknown Soundwire type\n");
>> + return -EINVAL;
>> + }
>> +
>> sdw_slave_modalias(slave, modalias, sizeof(modalias));
>> if (add_uevent_var(env, "MODALIAS=%s", modalias))
>
> Positive evaluation of is_sdw_slave() check is required for function to
> continue, thus you might as well do:
>
> if (!is_sdw_slave(dev)) {
> dev_warn();
> return -EINVAL;
> }
>
> slave = to_sdw_slave_device(dev);
see the following patch 7, it becomes a 2-case test (slave and master).
I am all for optimizations but wait until the actual changes are added...
Powered by blists - more mailing lists