From: Bartosz Golaszewski <brgl@bgdev.pl> To: Jonathan Cameron <jic23@kernel.org>, Hartmut Knaack <knaack.h@gmx.de>, Lars-Peter Clausen <lars@metafoo.de>, Peter Meerwald-Stadler <pmeerw@pmeerw.net>, Michal Simek <michal.simek@xilinx.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Guenter Roeck <linux@roeck-us.net>, Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski <bgolaszewski@baylibre.com> Subject: [PATCH v7 0/3] devres: provide and use devm_krealloc() Date: Mon, 17 Aug 2020 19:05:32 +0200 [thread overview] Message-ID: <20200817170535.17041-1-brgl@bgdev.pl> (raw) From: Bartosz Golaszewski <bgolaszewski@baylibre.com> Hi Greg, Andy, this is another reworked version of devm_krealloc(). This time without the risk of sleeping with spinlock taken but still with enough protection for the devres list. We're using slab's ksize() to determine whether the new size is larger than the current real size of the chunk and then either return the same pointer or manually alloc a new, larger chunk outside of the spinlock. === Regular krealloc() obviously can't work with managed memory. This series implements devm_krealloc() and adds two first users with hope that this helper will be adopted by other drivers currently using non-managed krealloc(). v1 -> v2: - remove leftover call to hwmon_device_unregister() from pmbus_core.c - add a patch extending devm_kmalloc() to handle zero size case - use WARN_ON() instead of WARN_ONCE() in devm_krealloc() when passed a pointer to non-managed memory - correctly handle the case when devm_krealloc() is passed a pointer to memory in .rodata (potentially returned by devm_kstrdup_const()) - correctly handle ZERO_SIZE_PTR passed as the ptr argument in devm_krealloc() v2 -> v3: - drop already applied patches - collect Acks - add an additional user in iio v3 -> v4: - add the kerneldoc for devm_krealloc() - WARN() outside of spinlock - rename local variable v4 -> v5: - tweak the kerneldoc v5 -> v6: - tweak the devres_lock handling in devm_krealloc() v6 -> v7: - rework devm_krealloc() to avoid calling krealloc() with spinlock taken Bartosz Golaszewski (3): devres: provide devm_krealloc() hwmon: pmbus: use more devres helpers iio: adc: xilinx-xadc: use devm_krealloc() .../driver-api/driver-model/devres.rst | 1 + drivers/base/devres.c | 93 +++++++++++++++++++ drivers/hwmon/pmbus/pmbus_core.c | 28 ++---- drivers/iio/adc/xilinx-xadc-core.c | 16 ++-- include/linux/device.h | 2 + 5 files changed, 113 insertions(+), 27 deletions(-) -- 2.26.1
WARNING: multiple messages have this Message-ID (diff)
From: Bartosz Golaszewski <brgl@bgdev.pl> To: Jonathan Cameron <jic23@kernel.org>, Hartmut Knaack <knaack.h@gmx.de>, Lars-Peter Clausen <lars@metafoo.de>, Peter Meerwald-Stadler <pmeerw@pmeerw.net>, Michal Simek <michal.simek@xilinx.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Guenter Roeck <linux@roeck-us.net>, Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: linux-iio@vger.kernel.org, Bartosz Golaszewski <bgolaszewski@baylibre.com>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v7 0/3] devres: provide and use devm_krealloc() Date: Mon, 17 Aug 2020 19:05:32 +0200 [thread overview] Message-ID: <20200817170535.17041-1-brgl@bgdev.pl> (raw) From: Bartosz Golaszewski <bgolaszewski@baylibre.com> Hi Greg, Andy, this is another reworked version of devm_krealloc(). This time without the risk of sleeping with spinlock taken but still with enough protection for the devres list. We're using slab's ksize() to determine whether the new size is larger than the current real size of the chunk and then either return the same pointer or manually alloc a new, larger chunk outside of the spinlock. === Regular krealloc() obviously can't work with managed memory. This series implements devm_krealloc() and adds two first users with hope that this helper will be adopted by other drivers currently using non-managed krealloc(). v1 -> v2: - remove leftover call to hwmon_device_unregister() from pmbus_core.c - add a patch extending devm_kmalloc() to handle zero size case - use WARN_ON() instead of WARN_ONCE() in devm_krealloc() when passed a pointer to non-managed memory - correctly handle the case when devm_krealloc() is passed a pointer to memory in .rodata (potentially returned by devm_kstrdup_const()) - correctly handle ZERO_SIZE_PTR passed as the ptr argument in devm_krealloc() v2 -> v3: - drop already applied patches - collect Acks - add an additional user in iio v3 -> v4: - add the kerneldoc for devm_krealloc() - WARN() outside of spinlock - rename local variable v4 -> v5: - tweak the kerneldoc v5 -> v6: - tweak the devres_lock handling in devm_krealloc() v6 -> v7: - rework devm_krealloc() to avoid calling krealloc() with spinlock taken Bartosz Golaszewski (3): devres: provide devm_krealloc() hwmon: pmbus: use more devres helpers iio: adc: xilinx-xadc: use devm_krealloc() .../driver-api/driver-model/devres.rst | 1 + drivers/base/devres.c | 93 +++++++++++++++++++ drivers/hwmon/pmbus/pmbus_core.c | 28 ++---- drivers/iio/adc/xilinx-xadc-core.c | 16 ++-- include/linux/device.h | 2 + 5 files changed, 113 insertions(+), 27 deletions(-) -- 2.26.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2020-08-17 17:30 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-17 17:05 Bartosz Golaszewski [this message] 2020-08-17 17:05 ` [PATCH v7 0/3] devres: provide and use devm_krealloc() Bartosz Golaszewski 2020-08-17 17:05 ` [PATCH v7 1/3] devres: provide devm_krealloc() Bartosz Golaszewski 2020-08-17 17:05 ` Bartosz Golaszewski 2020-08-17 17:39 ` Andy Shevchenko 2020-08-17 17:39 ` Andy Shevchenko 2020-08-17 20:02 ` Bartosz Golaszewski 2020-08-17 20:02 ` Bartosz Golaszewski 2020-08-18 8:25 ` Andy Shevchenko 2020-08-18 8:25 ` Andy Shevchenko 2020-08-18 16:27 ` Bartosz Golaszewski 2020-08-18 16:27 ` Bartosz Golaszewski 2020-08-18 17:10 ` Andy Shevchenko 2020-08-18 17:10 ` Andy Shevchenko 2020-08-18 18:13 ` Bartosz Golaszewski 2020-08-18 18:13 ` Bartosz Golaszewski 2020-08-19 9:14 ` Andy Shevchenko 2020-08-19 9:14 ` Andy Shevchenko 2020-08-17 17:05 ` [PATCH v7 2/3] hwmon: pmbus: use more devres helpers Bartosz Golaszewski 2020-08-17 17:05 ` Bartosz Golaszewski 2020-08-17 17:05 ` [PATCH v7 3/3] iio: adc: xilinx-xadc: use devm_krealloc() Bartosz Golaszewski 2020-08-17 17:05 ` Bartosz Golaszewski
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200817170535.17041-1-brgl@bgdev.pl \ --to=brgl@bgdev.pl \ --cc=andriy.shevchenko@linux.intel.com \ --cc=bgolaszewski@baylibre.com \ --cc=gregkh@linuxfoundation.org \ --cc=jic23@kernel.org \ --cc=knaack.h@gmx.de \ --cc=lars@metafoo.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-iio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@roeck-us.net \ --cc=michal.simek@xilinx.com \ --cc=pmeerw@pmeerw.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.