[PATCH v3 2/5] spi: sun6i: change OF match data to a struct

David Laight David.Laight at ACULAB.COM
Wed May 10 01:55:27 PDT 2023


From: Maxim Kiselev
> Sent: 10 May 2023 09:34
> 
> Hi, David
> 
> > Is it worth doing a structure copy at this point?
> > The 'cfg' data is short and constant and it would make
> > the code that uses it smaller and faster.
> 
> I'm sorry but I don't fully understand what you are suggesting.
> In patch 3\5 we extend the sun6i_spi_cfg structure with the has_clk_ctl field.

You are still only adding a second integer.

I'm suggesting that instead of sspi->cfg being a pointer to the
config data it is a copy of the config data.
So the assignment below becomes (ignoring error checks)
	memcpy(&sspi->cfg, of_device_get_match_data(&pdev->dev), sizeof sspi->cfg);
and the code that needs the values is:
	sspi->cfg.fifo_depth
(etc)

	David

> 
> пн, 8 мая 2023 г. в 12:47, David Laight <David.Laight at aculab.com>:
> >
> > From: Maksim Kiselev
> > > Sent: 07 May 2023 00:26
> > >
> > > As we're adding more properties to the OF match data, convert it to a
> > > struct now.
> > >
> > ...
> > > -     sspi->fifo_depth = (unsigned long)of_device_get_match_data(&pdev->dev);
> > > +     sspi->cfg = of_device_get_match_data(&pdev->dev);
> >
> > Is it worth doing a structure copy at this point?
> > The 'cfg' data is short and constant and it would make
> > the code that uses it smaller and faster.
> >
> >         David
> >
> > -
> > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> > Registration No: 1397386 (Wales)
> >

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


More information about the linux-riscv mailing list