[alsa-devel] [PATCH 2/2] ASoC: add driver for Rockchip RK3xxx I2S controller

Lars-Peter Clausen lars at metafoo.de
Tue Jul 1 16:57:07 CEST 2014


On 07/01/2014 04:49 PM, Huang Tao wrote:
> Dear Lars:

>
> 于 2014年07月01日 17:51, Lars-Peter Clausen 写道:
>>> +	/* Try to set the I2S Channel id from dt */
>>> >+	pdev->id = of_alias_get_id(np, "i2s");
>>> >+	dev_set_name(&pdev->dev, "%s.%d",
>>> >+				pdev->dev.driver->name,
>>> >+				pdev->id);
>> A device should not change its id or name.
>>
> Could you tell me the reason?
>

When registering a device the Linux device core that the id and name are 
unique. If you change them behind the back of the core there is no guarantee 
that they are still unique and undefined behavior might occur. Also changing 
them can cause all kind of other weird behavior, e.g. the name no longer 
matches the name of the sysfs files, etc.

- Lars


More information about the Alsa-devel mailing list