Thread (82 messages) 82 messages, 11 authors, 2024-11-22

Re: [PATCH v1 1/9] mfd: Add core driver for Nuvoton NCT6694

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2024-10-29 08:15:35
Also in: linux-can, linux-gpio, linux-hwmon, linux-i2c, linux-iio, linux-pwm, linux-rtc, linux-watchdog, lkml

On 29.10.2024 11:45:30, Ming Yu wrote:
quoted
quoted
quoted
You have a high coupling between the MFD driver and the individual
drivers anyways, so why not directly use the dynamically allocated
buffer provided by the caller and get rid of the memcpy()?
Okay! I will provide a function to request and free buffer for child devices,
and update the caller's variables to use these two functions in the next patch.
I don't see a need to provide dedicated function to allocate and free
the buffers. The caller can allocate them as part of their private data,
or allocate them during probe().
Okay, so each child device may allocate a buffer like this during probe():
priv->xmit_buf = devm_kcalloc(dev, MAX_PACKET_SZ, sizeof(unsigned char),
GFP_KERNEL), right?
basically yes, probably devm_kzalloc() or embed it into the priv struct
directly with ____cacheline_aligned:

| https://elixir.bootlin.com/linux/v6.11.5/source/drivers/net/can/spi/mcp251xfd/mcp251xfd.h#L498

The size of the driver's RX and TX buffers depend on what they want to
send and expect to receive. The next step would be to create structs the
describe the RX and TX buffers for each driver. If you have a common
header between each driver, create that first.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help