lkml.org 
[lkml]   [2018]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller driver
From
Date
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

\
 
 \ /
  Last update: 2018-12-22 18:01    [W:0.051 / U:15.036 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site