All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Glauber <jan.glauber-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	<linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Steven J. Hill"
	<steven.hill-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>,
	David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 6/6] spi: octeon: Add thunderx driver
Date: Mon, 25 Jul 2016 17:51:22 +0200	[thread overview]
Message-ID: <20160725155122.GA2710@hardcore> (raw)
In-Reply-To: <20160724210452.GB6345-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>

On Sun, Jul 24, 2016 at 10:04:52PM +0100, Mark Brown wrote:
> On Sat, Jul 23, 2016 at 12:42:55PM +0200, Jan Glauber wrote:
> 
> > +config SPI_THUNDERX
> > +	tristate "Cavium ThunderX SPI controller"
> > +	depends on 64BIT && PCI && !CAVIUM_OCTEON_SOC
> 
> This is a *weird* and most likely broken set of dependencies - why
> exclude this if we're on Octeon (or Octeon happens to have been enabled
> in a config)?

I agree that it looks weird, the reasoning is that we would like
to avoid making the driver depend on something like ARCH_THUNDER.

So I made the driver depend on the things it actually uses
(PCI for probing and 64BIT because of readq/writeq) and don't care if it
compiles on other platforms too (like x86).

That said, I can remove the !CAVIUM_OCTEON_SOC, it compiles without
errors on MIPS too. Would that be ok?

> > +static void thunderx_spi_clock_enable(struct device *dev, struct octeon_spi *p)
> > +{
> > +	int ret;
> > +
> > +	p->clk = devm_clk_get(dev, NULL);
> > +	if (IS_ERR(p->clk)) {
> > +		p->clk = NULL;
> > +		goto skip;
> > +	}
> 
> This is really not clever - we should be requesting clocks on probe, not
> only when we're trying to enable them, and using devm_ outside of probe
> paths is usually a warning sign too.  Now, this is actually called from
> probe so it works out fine but obviously it'd be better to improve the
> power management to only enable the clock when needed and at that point
> this function will be used and we'll fall into a bad pattern.
> 
> Given how tiny this function is and that we've not bothered splitting
> out any of the other resource acquisition it's probably better to just
> inline it into probe.

OK, I'll merge it into the probe function.

> > +	dev_info(&pdev->dev, "Cavium SPI bus driver probed\n");
> 
> Again, this is just adding noise to the boot log.
> 
> > +#define PCI_DEVICE_ID_THUNDERX_SPI      0xa00b
> > +
> > +static const struct pci_device_id thunderx_spi_pci_id_table[] = {
> > +	{ PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVICE_ID_THUNDERX_SPI) },
> > +	{ 0, }
> > +};
> 
> The define for the device ID doesn't seem to be adding much here.

I find it more readable instead of PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, 0xa00b),
or did I miss your point?

thanks,
Jan
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Jan Glauber <jan.glauber@caviumnetworks.com>
To: Mark Brown <broonie@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-spi@vger.kernel.org>,
	"Steven J. Hill" <steven.hill@cavium.com>,
	David Daney <david.daney@cavium.com>
Subject: Re: [PATCH 6/6] spi: octeon: Add thunderx driver
Date: Mon, 25 Jul 2016 17:51:22 +0200	[thread overview]
Message-ID: <20160725155122.GA2710@hardcore> (raw)
In-Reply-To: <20160724210452.GB6345@sirena.org.uk>

On Sun, Jul 24, 2016 at 10:04:52PM +0100, Mark Brown wrote:
> On Sat, Jul 23, 2016 at 12:42:55PM +0200, Jan Glauber wrote:
> 
> > +config SPI_THUNDERX
> > +	tristate "Cavium ThunderX SPI controller"
> > +	depends on 64BIT && PCI && !CAVIUM_OCTEON_SOC
> 
> This is a *weird* and most likely broken set of dependencies - why
> exclude this if we're on Octeon (or Octeon happens to have been enabled
> in a config)?

I agree that it looks weird, the reasoning is that we would like
to avoid making the driver depend on something like ARCH_THUNDER.

So I made the driver depend on the things it actually uses
(PCI for probing and 64BIT because of readq/writeq) and don't care if it
compiles on other platforms too (like x86).

That said, I can remove the !CAVIUM_OCTEON_SOC, it compiles without
errors on MIPS too. Would that be ok?

> > +static void thunderx_spi_clock_enable(struct device *dev, struct octeon_spi *p)
> > +{
> > +	int ret;
> > +
> > +	p->clk = devm_clk_get(dev, NULL);
> > +	if (IS_ERR(p->clk)) {
> > +		p->clk = NULL;
> > +		goto skip;
> > +	}
> 
> This is really not clever - we should be requesting clocks on probe, not
> only when we're trying to enable them, and using devm_ outside of probe
> paths is usually a warning sign too.  Now, this is actually called from
> probe so it works out fine but obviously it'd be better to improve the
> power management to only enable the clock when needed and at that point
> this function will be used and we'll fall into a bad pattern.
> 
> Given how tiny this function is and that we've not bothered splitting
> out any of the other resource acquisition it's probably better to just
> inline it into probe.

OK, I'll merge it into the probe function.

> > +	dev_info(&pdev->dev, "Cavium SPI bus driver probed\n");
> 
> Again, this is just adding noise to the boot log.
> 
> > +#define PCI_DEVICE_ID_THUNDERX_SPI      0xa00b
> > +
> > +static const struct pci_device_id thunderx_spi_pci_id_table[] = {
> > +	{ PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVICE_ID_THUNDERX_SPI) },
> > +	{ 0, }
> > +};
> 
> The define for the device ID doesn't seem to be adding much here.

I find it more readable instead of PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, 0xa00b),
or did I miss your point?

thanks,
Jan

  parent reply	other threads:[~2016-07-25 15:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-23 10:42 [PATCH 0/6] SPI ThunderX driver Jan Glauber
2016-07-23 10:42 ` Jan Glauber
2016-07-23 10:42 ` [PATCH 1/6] spi: octeon: Convert driver to use readq()/writeq() functions Jan Glauber
2016-07-23 10:42 ` [PATCH 2/6] spi: octeon: Store system clock freqency in struct octeon_spi Jan Glauber
2016-07-23 10:42 ` [PATCH 3/6] spi: octeon: Put register offsets into a struct Jan Glauber
2016-07-23 10:42 ` [PATCH 4/6] spi: octeon: Move include file from arch/mips to drivers/spi Jan Glauber
2016-07-23 10:42 ` [PATCH 5/6] spi: octeon: Split driver into Octeon specific and common parts Jan Glauber
2016-07-24 18:38   ` Paul Gortmaker
     [not found]     ` <CAP=VYLrQDwCfYFCkxd0N4PfgP-2U+pcw_Gm0Yo_8m0=0o3pBrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-25 11:32       ` Jan Glauber
2016-07-25 11:32         ` Jan Glauber
     [not found]   ` <edfc55f3653fedd5e13a8bd1282e089b269a4e61.1469174814.git.jglauber-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2016-07-24 20:54     ` Mark Brown
2016-07-24 20:54       ` Mark Brown
     [not found]       ` <20160724205416.GA6345-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-25 11:37         ` Jan Glauber
2016-07-25 11:37           ` Jan Glauber
2016-07-25 17:49         ` [PATCH v2] " Jan Glauber
2016-07-25 17:49           ` Jan Glauber
2016-07-23 10:42 ` [PATCH 6/6] spi: octeon: Add thunderx driver Jan Glauber
     [not found]   ` <f87d7a5ef8a713fb6e64c5d9471e7e5bf2051d18.1469174814.git.jglauber-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2016-07-24 21:04     ` Mark Brown
2016-07-24 21:04       ` Mark Brown
     [not found]       ` <20160724210452.GB6345-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-25 15:51         ` Jan Glauber [this message]
2016-07-25 15:51           ` Jan Glauber
2016-07-25 16:16           ` Mark Brown
     [not found]             ` <20160725161632.GD11806-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-25 16:31               ` David Daney
2016-07-25 16:31                 ` David Daney
2016-07-25 17:56                 ` [PATCH v2] " Jan Glauber
     [not found]                   ` <20160725175622.7167-1-jglauber-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2016-07-27 18:08                     ` Mark Brown
2016-07-27 18:08                       ` Mark Brown
     [not found]                       ` <20160727180824.GS11806-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-28  8:12                         ` Jan Glauber
2016-07-28  8:12                           ` Jan Glauber
2016-07-28 13:58                           ` Mark Brown
2016-07-28 13:58                             ` Mark Brown
     [not found]                 ` <57963ED3.4090402-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2016-07-27 18:12                   ` [PATCH 6/6] " Mark Brown
2016-07-27 18:12                     ` Mark Brown
     [not found]                     ` <20160727181205.GT11806-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-27 18:25                       ` David Daney
2016-07-27 18:25                         ` David Daney
     [not found]                         ` <5798FC86.8040601-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2016-07-27 19:08                           ` Mark Brown
2016-07-27 19:08                             ` Mark Brown
2016-07-25 16:20           ` 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=20160725155122.GA2710@hardcore \
    --to=jan.glauber-m3mlkvoiwjvv6pq1l3v1odbpr1lh4cv8@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=steven.hill-YGCgFSpz5w/QT0dZR+AlfA@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 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.