linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: First Light <xiaoguang.chen-dS4nfl7sBO4@public.gmane.org>
Cc: "linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Edison Chen <yongsen.chen-dS4nfl7sBO4@public.gmane.org>,
	Fang Yingju <yingju.fang-dS4nfl7sBO4@public.gmane.org>,
	Flare <jiaquan.su-dS4nfl7sBO4@public.gmane.org>
Subject: Re: Re: dw-spi driver bus number
Date: Thu, 11 Aug 2016 17:40:27 +0100	[thread overview]
Message-ID: <20160811164027.GW9347@sirena.org.uk> (raw)
In-Reply-To: <019c75c3a7b841eba898ca3542f2b5c9-wl3m2YU9F6jCyPUpEMH5pa0bRtRcJeJQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]

On Thu, Aug 11, 2016 at 01:13:27AM +0000, First Light wrote:
> > On Wed, Aug 10, 2016 at 08:50:08AM +0000, First Light wrote:

Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns.  Doing this makes your messages much
easier to read and reply to.

> > That shouldn't happen, if it does it's a bug - users should never see a negative
> > bus number, the core should dynamically assign one if it is given a negative bus
> > number.  Can you check what happens in spi_register_master()?  That's
> > where the dynamic bus number should be being assigned.

> [First Light] I'm using linux-4.4 kernel, and In spi-dw-mmio.c,
> I see that:
>  LINE74: dws->bus_num = pdev-->id; (dws is struct dw_spi, not struct spi_master)
>  LINE107: ret=dw_spi_add_host(&pdev->dev, dws);
> spi_register_master is called in dw_spi_add_host.
> So dws->bus_num is not dynamically assigned, but just one static value since pdev->id is not inited.

This doesn't matter so long as the default value passed into
spi_register_master() is negative.

> I think you are saying spi_master->bus_num is dynamically inited. Right?

Yes, but by spi_register_master().

> I also see that spi_master->bus_num is inited with dws->bus_number first, and the it finds that this bus_num < 0,
> then uses of_alias_get_id or atomic_dec_return(&dyn_bus_id) to get a dynamic one.

> Question is: do we need to update dws->bus_num again? It is -1 always.

No, just pass that into the core and the core should take care of
things.

> unlike other devices, like i2c0, i2c1,..., spi's device name is dw_spi65535,
> both of the spi devices I registered have this name. 65535 is -1.
> There must be something unmatched.

Please trace through the code and try to see where this is happening,
this doesn't seem to be affecting other users.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      parent reply	other threads:[~2016-08-11 16:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11  1:13 Re:Re: dw-spi driver bus number First Light
     [not found] ` <019c75c3a7b841eba898ca3542f2b5c9-wl3m2YU9F6jCyPUpEMH5pa0bRtRcJeJQ@public.gmane.org>
2016-08-11 16:40   ` Mark Brown [this message]

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=20160811164027.GW9347@sirena.org.uk \
    --to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=jiaquan.su-dS4nfl7sBO4@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=xiaoguang.chen-dS4nfl7sBO4@public.gmane.org \
    --cc=yingju.fang-dS4nfl7sBO4@public.gmane.org \
    --cc=yongsen.chen-dS4nfl7sBO4@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).