From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: masonccyang@mxic.com.tw
Cc: boris.brezillon@bootlin.com, broonie@kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>,
Simon Horman <horms@verge.net.au>,
juliensu@mxic.com.tw, linux-kernel@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-spi@vger.kernel.org,
marek.vasut@gmail.com, zhengxunli@mxic.com.tw
Subject: Re: [PATCH v2 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller driver
Date: Sat, 22 Dec 2018 17:20:16 +0300 [thread overview]
Message-ID: <908cd30d-10d9-a60d-8056-84924557bfbe@cogentembedded.com> (raw)
In-Reply-To: <OF719DFBAE.D0F9F117-ON4825836A.0039EEA3-4825836A.003B28D8@mxic.com.tw>
Hello!
On 12/21/2018 01:46 PM, masonccyang@mxic.com.tw wrote:
>> >>> +static ssize_t rpc_spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc,
>> >>> + u64 offs, size_t len, const void *buf)
>> >>> +{
>> >>> + struct rpc_spi *rpc = spi_master_get_devdata(desc->mem->spi->master);
>> >>> + int ret;
>> >>> +
>> >>> + if (WARN_ON(offs + desc->info.offset + len > U32_MAX))
>> >>> + return -EINVAL;
>> >>> +
>> >>> + if (WARN_ON(len > RPC_WBUF_SIZE))
>> >>> + return -EIO;
>> >>
>> >> Why not write 256 bytes and return w/that?
>> >
>> > in manual 62.3.13 Write Buffer Operation,
>> > transfer size to device is 256-byte unit.
>>
>> Why not write 256 bytes max and just return 256?
>>
>
> ?
> I don't get your point.
>
> here writes 256 byte each time and return 256 (len).
I mean not aborting the requests for >256 bytes right away (like you do) but
write only 256 bytes and return 256, not -EIO.
[...]
>> >>
>> >>> + for (i = 0; i < xfer[1].len; i++)
>> >>> + rpc->addr |= (u32)((u8 *)xfer[1].tx_buf)[i]
>> >>> + << (8 * (xfer[1].len - i - 1));
>> >>
>> >> Ugh, you need get_unaligned_*()...
>> >
>> > for accessing a single byte quantity, ((u8 *)xfer[1].tx_buf)[i] ?
>>
>> Ugh, never start a new line with an operator, lease it on a 1st,
Sorry -- leave, not lease.
>> broken up line.
>
> okay, patch it to:
>
> rpc->addr |= (u32)((u8 *)xfer[1].tx_buf)[i] <<
> (8 * (xfer[1].len - i - 1));
OK, thanks.
[...]
>> [...]
>> >> > +err_put_master:
>> >> > + spi_master_put(master);
>> >> > + pm_runtime_disable(&pdev->dev);
>> >> > +
>> >> > + return ret;
>> >> > +}
>> >> > +
>> >> > +static int rpc_spi_remove(struct platform_device *pdev)
>> >> > +{
>> >> > + struct spi_master *master = platform_get_drvdata(pdev);
>> >> > +
>> >> > + pm_runtime_disable(&pdev->dev);
>> >> > + spi_unregister_master(master);
>> >>
>> >> No spi_master_put() here?
>> >
>> > put_device() in spi_unregister_master().
>>
>> Why call spi_master_put() in the probe() method's error path?
>>
>
> called get_device() in spi_register_master() !
Hm, this is somewhat asymmetric...
> thanks & best regards,
> Mason
[...]
MBR, Sergei
next prev parent reply other threads:[~2018-12-22 17:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 9:18 [PATCH v2 0/2] spi: Add Renesas R-Car Gen3 RPC SPI driver Mason Yang
2018-12-03 9:18 ` [PATCH v2 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller driver Mason Yang
2018-12-04 18:43 ` Marek Vasut
[not found] ` <OF0ED3C578.141B72CA-ON4825835A.0025CA62-4825835A.002A7BDF@mxic.com.tw>
2018-12-05 9:11 ` Geert Uytterhoeven
2018-12-05 12:35 ` Marek Vasut
2018-12-05 12:49 ` Marek Vasut
2018-12-05 13:15 ` Geert Uytterhoeven
2018-12-05 13:24 ` Marek Vasut
2018-12-05 13:31 ` Geert Uytterhoeven
2018-12-05 13:34 ` Marek Vasut
[not found] ` <OFC9FB54F8.34B3A8B7-ON4825835B.00267480-4825835B.0029455C@mxic.com.tw>
2018-12-06 9:02 ` Marek Vasut
[not found] ` <OF0CE74C5C.20959BA6-ON4825835C.0026C7BC-4825835C.0028B3A4@mxic.com.tw>
2018-12-07 12:01 ` Marek Vasut
2018-12-06 9:12 ` Geert Uytterhoeven
2018-12-06 9:14 ` Marek Vasut
2018-12-05 9:06 ` Geert Uytterhoeven
[not found] ` <OFE69673FB.D4270C56-ON4825835B.001C7201-4825835B.00209DC7@mxic.com.tw>
2018-12-06 8:56 ` Marek Vasut
[not found] ` <OF62002C8B.5D0A4315-ON4825835B.0031F545-4825835B.003310A3@mxic.com.tw>
2018-12-06 9:19 ` Marek Vasut
2018-12-07 18:17 ` Sergei Shtylyov
2018-12-07 18:23 ` Marek Vasut
[not found] ` <OF1EDC1518.914B7F08-ON48258360.0022FD71-48258360.0033D3DE@mxic.com.tw>
2018-12-11 16:46 ` Sergei Shtylyov
[not found] ` <OF719DFBAE.D0F9F117-ON4825836A.0039EEA3-4825836A.003B28D8@mxic.com.tw>
2018-12-22 14:20 ` Sergei Shtylyov [this message]
2018-12-03 9:18 ` [PATCH v2 2/2] dt-binding: spi: Document Renesas R-Car Gen3 RPC controller bindings Mason Yang
2018-12-04 18:19 ` Marek Vasut
[not found] ` <OF71F19EC8.23C369C1-ON4825835A.002EB699-4825835A.002F949D@mxic.com.tw>
2018-12-05 12:53 ` Marek Vasut
2018-12-05 18:56 ` Sergei Shtylyov
2018-12-05 21:55 ` Marek Vasut
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=908cd30d-10d9-a60d-8056-84924557bfbe@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=boris.brezillon@bootlin.com \
--cc=broonie@kernel.org \
--cc=geert+renesas@glider.be \
--cc=horms@verge.net.au \
--cc=juliensu@mxic.com.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=marek.vasut@gmail.com \
--cc=masonccyang@mxic.com.tw \
--cc=zhengxunli@mxic.com.tw \
/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
all inboxes | Powered by JetHome®