From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Mark Brown <broonie@kernel.org>
Cc: Andy Gross <andy.gross@linaro.org>,
linux-spi@vger.kernel.org, David Brown <david.brown@linaro.org>,
linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: qup: provide proper bus numbers
Date: Thu, 21 Jan 2016 19:26:19 +0000 [thread overview]
Message-ID: <56A130DB.4080202@linaro.org> (raw)
In-Reply-To: <20160121190357.GO6588@sirena.org.uk>
On 21/01/16 19:03, Mark Brown wrote:
> On Thu, Jan 21, 2016 at 06:47:34PM +0000, Srinivas Kandagatla wrote:
>> On 21/01/16 18:38, Mark Brown wrote:
>>> On Thu, Jan 21, 2016 at 06:33:47PM +0000, Srinivas Kandagatla wrote:
>
>>>> This driver reuses pdev->id for spi bus numbers resulting in random
>>>> or very large bus numbering when used with device trees. pdev->id
>>>> is not the correct choice when using device trees. So add code to
>
>>> What makes you say this, why is pdev->id not "correct"? It is worrying
>>> if anything cares what number we pick.
>
>> Issue is that using pdev->id for bus number, as pdev->id does not get
>> populated in device tree cases.
>
> That's a statement of what currently happens...
>
>> The end users who are reading the schematics would not be able to map the
>> actual bus numbers on the schematics with the bus numbers allocated using
>> pdev->id. It add more confusion.
>
>> Without this patch the bus number allocated to this driver is 32766.
>> This does not really reflect the actual bus numbers on the boards
>> schematics.
>
> Is this really causing anyone any confusion? Normally people are
> looking at the devices on the SPI bus rather than the bus itself... In
> any case if this *is* causing confusion should we not be doing something
> at the bus core level that allows us to assign a descriptive name since
> this doesn't seem in the least bit SPI specific but could apply to any
> bus?
>
> There's also the problem that if someone has decided to label the bus
> with a descriptive name in their schematic (eg, "SPI_FLASH") then being
> able to assign a number doesn't do much to help, we'd need to be able to
> provide strings. A brief survey of schematics I have to hand suggests
> that this is a thing people do.
>
>>>> get bus numbers via device tree aliases and if it fails then generate
>>>> a unique bus number.
>
>>> The other question is even if this is a good idea why is it something
>>> that should be open coded in individual drivers, if we want to change
>>> the policy we should be consistent between drivers.
>
>> Device tree aliases seems used very much in many drivers.
>> The unique bus number scheme was actually inspired by the
>> driver/tty/serial/msm_serial.c
>
> That doesn't help explain why it is a good idea to open code this in
> individual drivers. I was asking why it's a good idea to do this in a
> single driver rather than at a higher level.
Oops!!, I should have looked at spi.c which already does exactly same
thing. I think the logic did not get triggered because (int)-1
overflowed into s16 busnum.
--srini
>
next prev parent reply other threads:[~2016-01-21 19:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-21 18:33 [PATCH] spi: qup: provide proper bus numbers Srinivas Kandagatla
2016-01-21 18:38 ` Mark Brown
[not found] ` <20160121183810.GN6588-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-01-21 18:47 ` Srinivas Kandagatla
2016-01-21 18:47 ` Srinivas Kandagatla
2016-01-21 19:03 ` Mark Brown
2016-01-21 19:26 ` Srinivas Kandagatla [this message]
2016-01-21 20:14 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56A130DB.4080202@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=andy.gross@linaro.org \
--cc=broonie@kernel.org \
--cc=david.brown@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.