Re: [alsa-devel] [PATCH 2/2] ASoC: add driver for Rockchip RK3xxx I2S controller
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
于 2014年07月01日 22:57, Lars-Peter Clausen 写道:
于 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
OK. Thanks! We will follow this rule on the future patches.
Best Regards,
Huang Tao
participants (2)
-
Huang Tao
-
Lars-Peter Clausen