[<prev] [next>] [day] [month] [year] [list]
Message-ID: <908cd30d-10d9-a60d-8056-84924557bfbe@cogentembedded.com>
Date: Sat, 22 Dec 2018 17:20:16 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: masonccyang@...c.com.tw
Cc: boris.brezillon@...tlin.com, broonie@...nel.org,
Geert Uytterhoeven <geert+renesas@...der.be>,
Simon Horman <horms@...ge.net.au>, juliensu@...c.com.tw,
linux-kernel@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-spi@...r.kernel.org, marek.vasut@...il.com,
zhengxunli@...c.com.tw
Subject: Re: [PATCH v2 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller
driver
Hello!
On 12/21/2018 01:46 PM, masonccyang@...c.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
Powered by blists - more mailing lists