Thread (10 messages) 10 messages, 2 authors, 2020-08-21

Re: [PATCH v8 1/3] devres: provide devm_krealloc()

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2020-08-21 08:18:48
Also in: linux-iio, lkml

On Fri, Aug 21, 2020 at 11:15:55AM +0300, Andy Shevchenko wrote:
On Thu, Aug 20, 2020 at 08:51:08PM +0200, Bartosz Golaszewski wrote:
...
quoted
+static struct devres *to_devres(void *data)
+{
+	return data - ALIGN(sizeof(struct devres), ARCH_KMALLOC_MINALIGN);
+}
+
+static size_t devres_data_size(size_t total_size)
+{
+	return total_size - ALIGN(sizeof(struct devres), ARCH_KMALLOC_MINALIGN);
+}
I'm fine with above, but here is a side note, perhaps

	offsetof(struct devres,	data)

will be more practical (no duplication of alignment and hence slightly better
maintenance)? (Note, I didn't check if it provides the correct result)
And if the result is correct wouldn't be first a simple container_of() after
all?
Another side note: do we have existing users of these helpers?
-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help