linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: zhangqing <zhangqing@loongson.cn>
Cc: Rob Herring <robh+dt@kernel.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-spi@vger.kernel.org, Huacai Chen <chenhc@lemote.com>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	devicetree@vger.kernel.org, linux-mips@vger.kernel.org,
	linux-kernel@vger.kernel.org, gaojuxin@loongson.cn,
	yangtiezhu@loongson.cn
Subject: Re: [PATCH v2 1/4] spi: LS7A: Add Loongson LS7A SPI controller driver support
Date: Wed, 9 Dec 2020 11:59:47 +0000	[thread overview]
Message-ID: <20201209115947.GA4790@sirena.org.uk> (raw)
In-Reply-To: <c916c525-7308-12a7-824b-7068fcead4cc@loongson.cn>

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

On Wed, Dec 09, 2020 at 03:24:15PM +0800, zhangqing wrote:

> > > +static int  ls7a_spi_transfer_one_message(struct spi_master *master,
> > > +                                         struct spi_message *m)

> > I don't understand why the driver is implementing transfer_one_message()
> > - it looks like this is just open coding the standard loop that the
> > framework provides and should just be using transfer_one().

> static int  ls7a_spi_transfer_one(struct spi_master *master,
>                       struct spi_device *spi,
>                                   struct spi_transfer *t)
> {
>     struct ls7a_spi *ls7a_spi;
>     int param, status;
> 
>     ls7a_spi = spi_master_get_devdata(master);
> 
>     spin_lock(&ls7a_spi->lock);
>     param = ls7a_spi_read_reg(ls7a_spi, PARA);
>     ls7a_spi_write_reg(ls7a_spi, PARA, param&~1);
>     spin_unlock(&ls7a_spi->lock);

I don't know what this does but is it better split out into a
prepare_message()?  It was only done once per message in your previous
implementation.  Or possibly runtime PM would be even better if that's
what it's doing.

> > ...releases the PCI regions in the remove() function before the SPI
> > controller is freed so the controller could still be active.
> 
>      static void ls7a_spi_pci_remove(struct pci_dev *pdev)
> {
>         struct spi_master *master = pci_get_drvdata(pdev);
> 
>      + spi_unregister_master(master);
>         pci_release_regions(pdev);
> }

You also need to change to using plain spi_register_master() but yes.
Otherwise everything looked good.

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

  reply	other threads:[~2020-12-09 12:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08  7:44 [PATCH v2 1/4] spi: LS7A: Add Loongson LS7A SPI controller driver support Qing Zhang
2020-12-08  7:44 ` [PATCH v2 2/4] spi: Add devicetree bindings documentation for Loongson SPI Qing Zhang
2020-12-08  7:49   ` Jiaxun Yang
2020-12-08  8:40   ` Sergei Shtylyov
2020-12-08 10:47     ` zhangqing
2020-12-08 13:58       ` Mark Brown
2020-12-09  1:21         ` zhangqing
2020-12-08 14:48       ` Sergei Shtylyov
2020-12-09  1:16         ` zhangqing
2020-12-08  7:44 ` [PATCH v2 3/4] MIPS: Loongson64: DTS: Add SPI support to LS7A Qing Zhang
2020-12-08  8:15   ` Jiaxun Yang
2020-12-08  7:44 ` [PATCH v2 4/4] MIPS: Loongson: Enable Loongson LS7A SPI in loongson3_defconfig Qing Zhang
2020-12-08 12:26 ` [PATCH v2 1/4] spi: LS7A: Add Loongson LS7A SPI controller driver support kernel test robot
2020-12-08 13:56 ` Mark Brown
2020-12-09  7:24   ` zhangqing
2020-12-09 11:59     ` Mark Brown [this message]
2020-12-08 21:36 ` kernel test robot

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=20201209115947.GA4790@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=chenhc@lemote.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gaojuxin@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=yangtiezhu@loongson.cn \
    --cc=zhangqing@loongson.cn \
    /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).