Re: [PATCH v2 1/1] spi: dw: Make debugfs name unique between instances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 4, 2017 at 4:21 AM, Phil Reid <preid@xxxxxxxxxxxxxxxxx> wrote:
> G'day Andy,
>
> On 4/01/2017 07:05, Andy Shevchenko wrote:
>>
>> On Wed, Jan 4, 2017 at 1:02 AM, Andy Shevchenko
>> <andy.shevchenko@xxxxxxxxx> wrote:
>>>
>>> On Tue, Jan 3, 2017 at 6:54 AM, Phil Reid <preid@xxxxxxxxxxxxxxxxx>
>>> wrote:
>>>>
>>>> Some system have multiple dw devices. Currently the driver uses a
>>>> fixed name for the debugfs dir. Append bus_num to the debugfs dir
>>>> name to make it unique.
>>>>
>>>
>>> Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
>>
>>
>> Ah, hold on.
>> dws->name is exactly what you are trying to re-invent here. Just use
>> it directly.
>>
> I did try that initially.
> However when I used that they where all named dw_spi65535.
>
> This seems to be because bus_num is set to -1 ion the call to
> dw_spi_add_host.
> Which results in dynamic bus_num assignment in the call to
> devm_spi_register_master.
>
> Moving 'snprintf(dws->name, sizeof(dws->name), "dw_spi%d", dws->bus_num);'
> to after
> devm_spi_register_master results in a warning being emitting when
> request_irq is called
> about an emit string at :
> WARNING: CPU: 0 PID: 1 at fs/proc/generic.c:369 __proc_create+0x1e8/0x1f0
>
> cat /proc/interrupts currently also shows dw_spi65535
>
> Rewrite dws->name after devm_spi_register_master is called fixes
> /proc/interrupts
> And it could then be used in debugfs.
> But does not fix the filename in /proc/irq/<num>/dw_spi65535
>
> I couldn't see a safe workaround with dws->name
> Unless we can move the request_irq to after devm_spi_register_master
>
> Thoughts?

I briefly checked couple of SPI drivers, they are doing
request_irq(..., dev_name(...), ...);

So, I propose to use that pattern for now, and move snprintf() call to
debugfs related code.

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux