From: Greg Kroah-Hartman Date: Wed, 3 Jan 2024 11:24:08 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v5.10.206~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4ebf62649a0a40d8554fb7281e182b5c1c75b46f;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: device-property-allow-const-parameter-to-dev_fwnode.patch --- diff --git a/queue-5.15/device-property-allow-const-parameter-to-dev_fwnode.patch b/queue-5.15/device-property-allow-const-parameter-to-dev_fwnode.patch new file mode 100644 index 00000000000..80be232aec7 --- /dev/null +++ b/queue-5.15/device-property-allow-const-parameter-to-dev_fwnode.patch @@ -0,0 +1,70 @@ +From b295d484b97081feba72b071ffcb72fb4638ccfd Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Tue, 4 Oct 2022 12:21:25 +0300 +Subject: device property: Allow const parameter to dev_fwnode() + +From: Andy Shevchenko + +commit b295d484b97081feba72b071ffcb72fb4638ccfd upstream. + +It's not fully correct to take a const parameter pointer to a struct +and return a non-const pointer to a member of that struct. + +Instead, introduce a const version of the dev_fwnode() API which takes +and returns const pointers and use it where it's applicable. + +With this, convert dev_fwnode() to be a macro wrapper on top of const +and non-const APIs that chooses one based on the type. + +Suggested-by: Sakari Ailus +Fixes: aade55c86033 ("device property: Add const qualifier to device_get_match_data() parameter") +Signed-off-by: Andy Shevchenko +Acked-by: Heikki Krogerus +Reviewed-by: Sakari Ailus +Link: https://lore.kernel.org/r/20221004092129.19412-2-andriy.shevchenko@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/base/property.c | 11 +++++++++-- + include/linux/property.h | 7 ++++++- + 2 files changed, 15 insertions(+), 3 deletions(-) + +--- a/drivers/base/property.c ++++ b/drivers/base/property.c +@@ -18,12 +18,19 @@ + #include + #include + +-struct fwnode_handle *dev_fwnode(const struct device *dev) ++struct fwnode_handle *__dev_fwnode(struct device *dev) + { + return IS_ENABLED(CONFIG_OF) && dev->of_node ? + of_fwnode_handle(dev->of_node) : dev->fwnode; + } +-EXPORT_SYMBOL_GPL(dev_fwnode); ++EXPORT_SYMBOL_GPL(__dev_fwnode); ++ ++const struct fwnode_handle *__dev_fwnode_const(const struct device *dev) ++{ ++ return IS_ENABLED(CONFIG_OF) && dev->of_node ? ++ of_fwnode_handle(dev->of_node) : dev->fwnode; ++} ++EXPORT_SYMBOL_GPL(__dev_fwnode_const); + + /** + * device_property_present - check if a property of a device is present +--- a/include/linux/property.h ++++ b/include/linux/property.h +@@ -31,7 +31,12 @@ enum dev_dma_attr { + DEV_DMA_COHERENT, + }; + +-struct fwnode_handle *dev_fwnode(const struct device *dev); ++const struct fwnode_handle *__dev_fwnode_const(const struct device *dev); ++struct fwnode_handle *__dev_fwnode(struct device *dev); ++#define dev_fwnode(dev) \ ++ _Generic((dev), \ ++ const struct device *: __dev_fwnode_const, \ ++ struct device *: __dev_fwnode)(dev) + + bool device_property_present(struct device *dev, const char *propname); + int device_property_read_u8_array(struct device *dev, const char *propname, diff --git a/queue-5.15/series b/queue-5.15/series index 7b5635a315d..90d10978724 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -77,12 +77,12 @@ ethernet-constify-references-to-netdev-dev_addr-in-d.patch net-usb-ax88179_178a-clean-up-pm-calls.patch net-usb-ax88179_178a-wol-optimizations.patch net-usb-ax88179_178a-avoid-failed-operations-when-de.patch +device-property-add-const-qualifier-to-device_get_ma.patch spi-introduce-spi_get_device_match_data-helper.patch iio-imu-adis16475-add-spi_device_id-table.patch smb-client-fix-oob-in-smb2_query_info_init.patch smb-client-fix-oob-in-smbcalcsize.patch bluetooth-af_bluetooth-fix-use-after-free-in-bt_sock.patch -device-property-add-const-qualifier-to-device_get_ma.patch mm-filemap-avoid-buffered-read-write-race-to-read-inconsistent-data.patch ring-buffer-fix-wake-ups-when-buffer_percent-is-set-to-100.patch tracing-fix-blocked-reader-of-snapshot-buffer.patch @@ -91,3 +91,4 @@ ksmbd-fix-slab-out-of-bounds-in-smb_strndup_from_utf16.patch netfilter-nf_tables-skip-set-commit-for-deleted-destroyed-sets.patch ring-buffer-fix-slowpath-of-interrupted-event.patch dm-integrity-don-t-modify-bio-s-immutable-bio_vec-in-integrity_metadata.patch +device-property-allow-const-parameter-to-dev_fwnode.patch