Commit 1f4c7f3b authored by Andy Shevchenko's avatar Andy Shevchenko
Browse files

Merge patch series "Split devres APIs to device/devres.h and introduce devm_kmemdup_array()"

Raag Jadav <raag.jadav@intel.com> says:

This series

1. Splits device/devres.h for the users that are only interested in devres APIs.
   Original work by Andy Shevchenko:
   https://lore.kernel.org/r/20241203195340.855879-1-andriy.shevchenko@linux.intel.com

2. Introduces a more robust and cleaner devm_kmemdup_array() helper and uses it
   across drivers.

The idea behind embedding both work into a single series is to make the review
process easier and reduce conflicts while merging.

Link: https://lore.kernel.org/r/20250212062513.2254767-1-raag.jadav@intel.com


Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parents 2014c95a b8c38ccb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1245,8 +1245,8 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, unsigned int *conf, int irq)
		channel_templates = xadc_us_channels;
		max_channels = ARRAY_SIZE(xadc_us_channels);
	}
	channels = devm_kmemdup(dev, channel_templates,
				sizeof(channels[0]) * max_channels, GFP_KERNEL);
	channels = devm_kmemdup_array(dev, channel_templates, max_channels,
				      sizeof(*channel_templates), GFP_KERNEL);
	if (!channels)
		return -ENOMEM;

+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
 */

#include <linux/device.h>
#include <linux/device/devres.h>
#include <linux/err.h>
#include <linux/gfp_types.h>
#include <linux/i2c.h>
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
 */

#include <linux/device.h>
#include <linux/device/devres.h>
#include <linux/err.h>
#include <linux/gfp_types.h>
#include <linux/module.h>
+2 −3
Original line number Diff line number Diff line
@@ -102,9 +102,8 @@ static int micro_key_probe(struct platform_device *pdev)

	keys->input->keycodesize = sizeof(micro_keycodes[0]);
	keys->input->keycodemax = ARRAY_SIZE(micro_keycodes);
	keys->codes = devm_kmemdup(&pdev->dev, micro_keycodes,
			   keys->input->keycodesize * keys->input->keycodemax,
			   GFP_KERNEL);
	keys->codes = devm_kmemdup_array(&pdev->dev, micro_keycodes, keys->input->keycodemax,
					 keys->input->keycodesize, GFP_KERNEL);
	if (!keys->codes)
		return -ENOMEM;

+1 −2
Original line number Diff line number Diff line
@@ -176,8 +176,7 @@ int sparse_keymap_setup(struct input_dev *dev,
	for (e = keymap; e->type != KE_END; e++)
		map_size++;

	map = devm_kmemdup(&dev->dev, keymap, map_size * sizeof(*map),
			   GFP_KERNEL);
	map = devm_kmemdup_array(&dev->dev, keymap, map_size, sizeof(*keymap), GFP_KERNEL);
	if (!map)
		return -ENOMEM;

Loading