lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMuHMdWn3mgzwX55+OCWwMZwvfXkh7B+n-b0uChAW5gbx9b7Dw@mail.gmail.com>
Date:	Thu, 27 Nov 2014 10:41:23 +0100
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Dave Gerlach <d-gerlach@...com>
Cc:	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>,
	Linux-Arch <linux-arch@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	Russ Dill <russ.dill@...com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Arnd Bergmann <arnd@...db.de>,
	Philipp Zabel <p.zabel@...gutronix.de>,
	Shawn Guo <shawn.guo@...escale.com>,
	Tony Lindgren <tony@...mide.com>, Anson.Huang@...escale.com,
	Josh Triplett <josh@...htriplett.org>
Subject: Re: [RFC PATCH 2/2] lib: devres: Add exec versions of
 devm_ioremap_resource and friends

On Wed, Nov 26, 2014 at 10:14 PM, Dave Gerlach <d-gerlach@...com> wrote:
> --- a/lib/devres.c
> +++ b/lib/devres.c
> @@ -72,6 +72,64 @@ void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
>  EXPORT_SYMBOL(devm_ioremap_nocache);
>
>  /**
> + * devm_ioremap_exec - Managed ioremap_exec()
> + * @dev: Generic device to remap IO address for
> + * @offset: BUS offset to map
> + * @size: Size of map
> + *
> + * Managed ioremap_exec().  Map is automatically unmapped on driver detach.
> + */
> +void __iomem *devm_ioremap_exec(struct device *dev, resource_size_t offset,
> +                               unsigned long size)
> +{

[...]

> +       addr = ioremap_exec(offset, size);

[...]

> +}
> +EXPORT_SYMBOL(devm_ioremap_exec);
> +
> +/**
> + * devm_ioremap_exec_nocache - Managed ioremap_exec_nocache()
> + * @dev: Generic device to remap IO address for
> + * @offset: BUS offset to map
> + * @size: Size of map
> + *
> + * Managed ioremap_exec_nocache().  Map is automatically unmapped on driver
> + * detach.
> + */
> +void __iomem *devm_ioremap_exec_nocache(struct device *dev,
> +                                       resource_size_t offset,
> +                                       unsigned long size)
> +{

[...]

> +       addr = ioremap_exec_nocache(offset, size);

[...]

> +}
> +EXPORT_SYMBOL(devm_ioremap_exec_nocache);
> +

Both of these are identical to the already-existing devm_ioremap() and
devm_ioremap_nocache(), except for the call to the underlying
ioremap*() variant.

Can't the variant selection be done by passing a flag around, set by
the top-level inline functions, to avoid code duplication?
Some architecture-specific ioremap() implementations already work that
way, cfr. arch/m68k/include/asm/io_mm.h:

static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
{
        return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
}
static inline void __iomem *ioremap_nocache(unsigned long physaddr,
unsigned lonn
g size)
{
        return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
}
static inline void __iomem *ioremap_writethrough(unsigned long physaddr,
                                         unsigned long size)
{
        return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
}
static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
                                      unsigned long size)
{
        return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
}

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ