lkml.org 
[lkml]   [2020]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] stmmac: debugfs entry name is not be changed when udev rename device name.
From
Date


On 01/05/2020 12:18 PM, David Miller wrote:
> From: Jiping Ma <jiping.ma2@windriver.com>
> Date: Thu, 2 Jan 2020 09:35:44 +0800
>
>> Add one notifier for udev changes net device name.
>>
>> Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
>> ---
>> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 28 +++++++++++++++++++
>> 1 file changed, 28 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index b14f46a57154..3b05cb80eed7 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -4038,6 +4038,31 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v)
>> }
>> DEFINE_SHOW_ATTRIBUTE(stmmac_dma_cap);
>>
>> +/* Use network device events to rename debugfs file entries.
>> + */
>> +static int stmmac_device_event(struct notifier_block *unused,
>> + unsigned long event, void *ptr)
>> +{
>> + struct net_device *dev = netdev_notifier_info_to_dev(ptr);
>> + struct stmmac_priv *priv = netdev_priv(dev);
>> +
>> + switch (event) {
>> + case NETDEV_CHANGENAME:
> This notifier gets called for every single netdevice in the entire
> system.
>
> You cannot just assume that the device that gets passed in here is
> an stmmac device.
>
> Look at how other drivers handle this to see how to do it correctly.
>
> Thank you.
Thanks to remind.  I will modify it and send it review again.
>

\
 
 \ /
  Last update: 2020-01-06 02:32    [W:0.092 / U:1.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site