Skip to content

Commit eef778c

Browse files
arndbtorvalds
authored andcommitted
devres: allow const resource arguments
devm_ioremap_resource() does not currently take 'const' arguments, which results in a warning from the first driver trying to do it anyway: drivers/gpio/gpio-amd-fch.c: In function 'amd_fch_gpio_probe': drivers/gpio/gpio-amd-fch.c:171:49: error: passing argument 2 of 'devm_ioremap_resource' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] priv->base = devm_ioremap_resource(&pdev->dev, &amd_fch_gpio_iores); ^~~~~~~~~~~~~~~~~~~ Change the prototype to allow it, as there is no real reason not to. Link: http://lkml.kernel.org/r/20190628150049.1108048-1-arnd@arndb.de Fixes: 9bb2e0452508 ("gpio: amd: Make resource struct const") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Cc: Ulf Hansson <ulf.hansson@linaro.org> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent dffcac2 commit eef778c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎include/linux/device.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,8 @@ extern unsigned long devm_get_free_pages(struct device *dev,
704704
gfp_t gfp_mask, unsigned int order);
705705
extern void devm_free_pages(struct device *dev, unsigned long addr);
706706

707-
void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
707+
void __iomem *devm_ioremap_resource(struct device *dev,
708+
const struct resource *res);
708709

709710
void __iomem *devm_of_iomap(struct device *dev,
710711
struct device_node *node, int index,

‎lib/devres.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ EXPORT_SYMBOL(devm_iounmap);
131131
* if (IS_ERR(base))
132132
* return PTR_ERR(base);
133133
*/
134-
void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res)
134+
void __iomem *devm_ioremap_resource(struct device *dev,
135+
const struct resource *res)
135136
{
136137
resource_size_t size;
137138
void __iomem *dest_ptr;

0 commit comments

Comments
 (0)