mbox series

[v3,0/4] devres: Provide krealloc_array

Message ID 20230320145710.1120469-1-james.clark@arm.com
Headers show
Series devres: Provide krealloc_array | expand

Message

James Clark March 20, 2023, 2:57 p.m. UTC
Changes since v2:
 
 * Remove change in qcom_geni_serial.c in the last commmit and replace
   it with a comment instead
 * Whitespace fix

Changes since v1:

 * Style fix

-----------------------

Hi,

I had a use for a devm realloc_array in a separate change, so I've
added one and updated all the obvious existing uses of it that I could
find. This is basically a copy paste of the one in slab.h

Applies to v6.3-rc3

Thanks
James

James Clark (4):
  devres: Provide krealloc_array
  hwmon: pmbus: Use devm_krealloc_array
  iio: adc: Use devm_krealloc_array
  serial: qcom_geni: Comment use of devm_krealloc rather than
    devm_krealloc_array

 .../driver-api/driver-model/devres.rst          |  1 +
 drivers/hwmon/pmbus/pmbus_core.c                |  6 +++---
 drivers/iio/adc/xilinx-ams.c                    |  9 +++------
 drivers/iio/adc/xilinx-xadc-core.c              | 17 +++++++----------
 drivers/tty/serial/qcom_geni_serial.c           |  5 +++++
 include/linux/device.h                          | 11 +++++++++++
 6 files changed, 30 insertions(+), 19 deletions(-)

Comments

Jonathan Cameron March 25, 2023, 7:14 p.m. UTC | #1
On Mon, 20 Mar 2023 14:57:09 +0000
James Clark <james.clark@arm.com> wrote:

> Now that devm_krealloc_array is available, add a comment justifying not
> changing this occurrence to avoid any future auto fixups.
> 
> Link: https://lore.kernel.org/all/20230318173402.20a4f60d@jic23-huawei/
> Signed-off-by: James Clark <james.clark@arm.com>
LGTM

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/tty/serial/qcom_geni_serial.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 28fbc927a546..8ae1fb7c2636 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1055,6 +1055,11 @@ static int setup_fifos(struct qcom_geni_serial_port *port)
>  		(port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE;
>  
>  	if (port->rx_buf && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) {
> +		/*
> +		 * Use krealloc rather than krealloc_array because rx_buf is
> +		 * accessed as 1 byte entries as well as 4 byte entries so it's
> +		 * not necessarily an array.
> +		 */
>  		port->rx_buf = devm_krealloc(uport->dev, port->rx_buf,
>  					     port->rx_fifo_depth * sizeof(u32),
>  					     GFP_KERNEL);
James Clark April 25, 2023, 12:51 p.m. UTC | #2
On 20/03/2023 14:57, James Clark wrote:
> Changes since v2:
>  
>  * Remove change in qcom_geni_serial.c in the last commmit and replace
>    it with a comment instead
>  * Whitespace fix
> 
> Changes since v1:
> 
>  * Style fix
> 
> -----------------------
> 
> Hi,
> 
> I had a use for a devm realloc_array in a separate change, so I've
> added one and updated all the obvious existing uses of it that I could
> find. This is basically a copy paste of the one in slab.h
> 
> Applies to v6.3-rc3
> 
> Thanks
> James
> 
> James Clark (4):
>   devres: Provide krealloc_array
>   hwmon: pmbus: Use devm_krealloc_array
>   iio: adc: Use devm_krealloc_array
>   serial: qcom_geni: Comment use of devm_krealloc rather than
>     devm_krealloc_array
> 
>  .../driver-api/driver-model/devres.rst          |  1 +
>  drivers/hwmon/pmbus/pmbus_core.c                |  6 +++---
>  drivers/iio/adc/xilinx-ams.c                    |  9 +++------
>  drivers/iio/adc/xilinx-xadc-core.c              | 17 +++++++----------
>  drivers/tty/serial/qcom_geni_serial.c           |  5 +++++
>  include/linux/device.h                          | 11 +++++++++++
>  6 files changed, 30 insertions(+), 19 deletions(-)
> 

Hi Greg,

Is it possible to take this one? Or at least the first commit?

Thanks
James
Greg KH April 25, 2023, 1 p.m. UTC | #3
On Tue, Apr 25, 2023 at 01:51:31PM +0100, James Clark wrote:
> 
> 
> On 20/03/2023 14:57, James Clark wrote:
> > Changes since v2:
> >  
> >  * Remove change in qcom_geni_serial.c in the last commmit and replace
> >    it with a comment instead
> >  * Whitespace fix
> > 
> > Changes since v1:
> > 
> >  * Style fix
> > 
> > -----------------------
> > 
> > Hi,
> > 
> > I had a use for a devm realloc_array in a separate change, so I've
> > added one and updated all the obvious existing uses of it that I could
> > find. This is basically a copy paste of the one in slab.h
> > 
> > Applies to v6.3-rc3
> > 
> > Thanks
> > James
> > 
> > James Clark (4):
> >   devres: Provide krealloc_array
> >   hwmon: pmbus: Use devm_krealloc_array
> >   iio: adc: Use devm_krealloc_array
> >   serial: qcom_geni: Comment use of devm_krealloc rather than
> >     devm_krealloc_array
> > 
> >  .../driver-api/driver-model/devres.rst          |  1 +
> >  drivers/hwmon/pmbus/pmbus_core.c                |  6 +++---
> >  drivers/iio/adc/xilinx-ams.c                    |  9 +++------
> >  drivers/iio/adc/xilinx-xadc-core.c              | 17 +++++++----------
> >  drivers/tty/serial/qcom_geni_serial.c           |  5 +++++
> >  include/linux/device.h                          | 11 +++++++++++
> >  6 files changed, 30 insertions(+), 19 deletions(-)
> > 
> 
> Hi Greg,
> 
> Is it possible to take this one? Or at least the first commit?

It's the middle of the merge window, no one can take anything new,
sorry.  Please wait for -rc1 to come out and then resend.

thanks,

greg k-h