* Re: [PATCH 1/7] ocxl: Provide global MMIO accessors for external drivers
From: Andrew Donnellan @ 2019-03-15 4:11 UTC (permalink / raw)
To: Alastair D'Silva
Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel, Greg Kurz,
Alastair D'Silva, Frederic Barrat, linuxppc-dev
In-Reply-To: <20190313041524.14644-2-alastair@au1.ibm.com>
On 13/3/19 3:15 pm, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> External drivers that communicate via OpenCAPI will need to make
> MMIO calls to interact with the devices.
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> Reviewed-by: Greg Kurz <groug@kaod.org>
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---
> drivers/misc/ocxl/Makefile | 2 +-
> drivers/misc/ocxl/mmio.c | 234 +++++++++++++++++++++++++++++++++++++
> include/misc/ocxl.h | 113 ++++++++++++++++++
> 3 files changed, 348 insertions(+), 1 deletion(-)
> create mode 100644 drivers/misc/ocxl/mmio.c
>
> diff --git a/drivers/misc/ocxl/Makefile b/drivers/misc/ocxl/Makefile
> index 5229dcda8297..922e47cd4f0d 100644
> --- a/drivers/misc/ocxl/Makefile
> +++ b/drivers/misc/ocxl/Makefile
> @@ -1,7 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0+
> ccflags-$(CONFIG_PPC_WERROR) += -Werror
>
> -ocxl-y += main.o pci.o config.o file.o pasid.o
> +ocxl-y += main.o pci.o config.o file.o pasid.o mmio.o
> ocxl-y += link.o context.o afu_irq.o sysfs.o trace.o
> obj-$(CONFIG_OCXL) += ocxl.o
>
> diff --git a/drivers/misc/ocxl/mmio.c b/drivers/misc/ocxl/mmio.c
> new file mode 100644
> index 000000000000..7f6ebae1c6c7
> --- /dev/null
> +++ b/drivers/misc/ocxl/mmio.c
> @@ -0,0 +1,234 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +// Copyright 2017 IBM Corp.
> +#include <linux/sched/mm.h>
> +#include "trace.h"
> +#include "ocxl_internal.h"
> +
> +int ocxl_global_mmio_read32(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u32 *val)
> +{
> + if (offset > afu->config.global_mmio_size - 4)
> + return -EINVAL;
> +
> +#ifdef __BIG_ENDIAN__
> + if (endian == OCXL_HOST_ENDIAN)
> + endian = OCXL_BIG_ENDIAN;
> +#endif
> +
> + switch (endian) {
> + case OCXL_BIG_ENDIAN:
> + *val = readl_be((char *)afu->global_mmio_ptr + offset);
> + break;
> +
> + default:
> + *val = readl((char *)afu->global_mmio_ptr + offset);
> + break;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(ocxl_global_mmio_read32);
> +
> +int ocxl_global_mmio_read64(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u64 *val)
> +{
> + if (offset > afu->config.global_mmio_size - 8)
> + return -EINVAL;
> +
> +#ifdef __BIG_ENDIAN__
> + if (endian == OCXL_HOST_ENDIAN)
> + endian = OCXL_BIG_ENDIAN;
> +#endif
> +
> + switch (endian) {
> + case OCXL_BIG_ENDIAN:
> + *val = readq_be((char *)afu->global_mmio_ptr + offset);
> + break;
> +
> + default:
> + *val = readq((char *)afu->global_mmio_ptr + offset);
> + break;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(ocxl_global_mmio_read64);
> +
> +int ocxl_global_mmio_write32(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u32 val)
> +{
> + if (offset > afu->config.global_mmio_size - 4)
> + return -EINVAL;
> +
> +#ifdef __BIG_ENDIAN__
> + if (endian == OCXL_HOST_ENDIAN)
> + endian = OCXL_BIG_ENDIAN;
> +#endif
> +
> + switch (endian) {
> + case OCXL_BIG_ENDIAN:
> + writel_be(val, (char *)afu->global_mmio_ptr + offset);
> + break;
> +
> + default:
> + writel(val, (char *)afu->global_mmio_ptr + offset);
> + break;
> + }
> +
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(ocxl_global_mmio_write32);
> +
> +int ocxl_global_mmio_write64(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u64 val)
> +{
> + if (offset > afu->config.global_mmio_size - 8)
> + return -EINVAL;
> +
> +#ifdef __BIG_ENDIAN__
> + if (endian == OCXL_HOST_ENDIAN)
> + endian = OCXL_BIG_ENDIAN;
> +#endif
> +
> + switch (endian) {
> + case OCXL_BIG_ENDIAN:
> + writeq_be(val, (char *)afu->global_mmio_ptr + offset);
> + break;
> +
> + default:
> + writeq(val, (char *)afu->global_mmio_ptr + offset);
> + break;
> + }
> +
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(ocxl_global_mmio_write64);
> +
> +int ocxl_global_mmio_set32(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u32 mask)
> +{
> + u32 tmp;
> +
> + if (offset > afu->config.global_mmio_size - 4)
> + return -EINVAL;
> +
> +#ifdef __BIG_ENDIAN__
> + if (endian == OCXL_HOST_ENDIAN)
> + endian = OCXL_BIG_ENDIAN;
> +#endif
> +
> + switch (endian) {
> + case OCXL_BIG_ENDIAN:
> + tmp = readl_be((char *)afu->global_mmio_ptr + offset);
> + tmp |= mask;
> + writel_be(tmp, (char *)afu->global_mmio_ptr + offset);
> + break;
> +
> + default:
> + tmp = readl((char *)afu->global_mmio_ptr + offset);
> + tmp |= mask;
> + writel(tmp, (char *)afu->global_mmio_ptr + offset);
> + break;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(ocxl_global_mmio_set32);
> +
> +int ocxl_global_mmio_set64(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u64 mask)
> +{
> + u64 tmp;
> +
> + if (offset > afu->config.global_mmio_size - 8)
> + return -EINVAL;
> +
> +#ifdef __BIG_ENDIAN__
> + if (endian == OCXL_HOST_ENDIAN)
> + endian = OCXL_BIG_ENDIAN;
> +#endif
> +
> + switch (endian) {
> + case OCXL_BIG_ENDIAN:
> + tmp = readq_be((char *)afu->global_mmio_ptr + offset);
> + tmp |= mask;
> + writeq_be(tmp, (char *)afu->global_mmio_ptr + offset);
> + break;
> +
> + default:
> + tmp = readq((char *)afu->global_mmio_ptr + offset);
> + tmp |= mask;
> + writeq(tmp, (char *)afu->global_mmio_ptr + offset);
> + break;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(ocxl_global_mmio_set64);
> +
> +int ocxl_global_mmio_clear32(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u32 mask)
> +{
> + u32 tmp;
> +
> + if (offset > afu->config.global_mmio_size - 4)
> + return -EINVAL;
> +
> +#ifdef __BIG_ENDIAN__
> + if (endian == OCXL_HOST_ENDIAN)
> + endian = OCXL_BIG_ENDIAN;
> +#endif
> +
> + switch (endian) {
> + case OCXL_BIG_ENDIAN:
> + tmp = readl_be((char *)afu->global_mmio_ptr + offset);
> + tmp &= ~mask;
> + writel_be(tmp, (char *)afu->global_mmio_ptr + offset);
> + break;
> +
> + default:
> + tmp = readl((char *)afu->global_mmio_ptr + offset);
> + tmp &= ~mask;
> + writel(tmp, (char *)afu->global_mmio_ptr + offset);
> + break;
> + }
> +
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(ocxl_global_mmio_clear32);
> +
> +int ocxl_global_mmio_clear64(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u64 mask)
> +{
> + u64 tmp;
> +
> + if (offset > afu->config.global_mmio_size - 8)
> + return -EINVAL;
> +
> +#ifdef __BIG_ENDIAN__
> + if (endian == OCXL_HOST_ENDIAN)
> + endian = OCXL_BIG_ENDIAN;
> +#endif
> +
> + switch (endian) {
> + case OCXL_BIG_ENDIAN:
> + tmp = readq_be((char *)afu->global_mmio_ptr + offset);
> + tmp &= ~mask;
> + writeq_be(tmp, (char *)afu->global_mmio_ptr + offset);
> + break;
> +
> + default:
> + tmp = readq((char *)afu->global_mmio_ptr + offset);
> + tmp &= ~mask;
> + writeq(tmp, (char *)afu->global_mmio_ptr + offset);
> + break;
> + }
> +
> + writeq(tmp, (char *)afu->global_mmio_ptr + offset);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(ocxl_global_mmio_clear64);
> diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h
> index 9530d3be1b30..3b320c39f0af 100644
> --- a/include/misc/ocxl.h
> +++ b/include/misc/ocxl.h
> @@ -49,6 +49,119 @@ struct ocxl_fn_config {
> s8 max_afu_index;
> };
>
> +// These are opaque outside the ocxl driver
> +struct ocxl_afu;
> +
> +enum ocxl_endian {
> + OCXL_BIG_ENDIAN = 0, /**< AFU data is big-endian */
> + OCXL_LITTLE_ENDIAN = 1, /**< AFU data is little-endian */
> + OCXL_HOST_ENDIAN = 2, /**< AFU data is the same endianness as the host */
> +};
> +
> +/**
> + * Read a 32 bit value from global MMIO
> + *
> + * @afu: The AFU
> + * @offset: The Offset from the start of MMIO
> + * @endian: the endianness that the MMIO data is in
> + * @val: returns the value
> + *
> + * Returns 0 for success, negative on error
> + */
> +int ocxl_global_mmio_read32(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u32 *val);
> +
> +/**
> + * Read a 64 bit value from global MMIO
> + *
> + * @afu: The AFU
> + * @offset: The Offset from the start of MMIO
> + * @endian: the endianness that the MMIO data is in
> + * @val: returns the value
> + *
> + * Returns 0 for success, negative on error
> + */
> +int ocxl_global_mmio_read64(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u64 *val);
> +
> +/**
> + * Write a 32 bit value to global MMIO
> + *
> + * @afu: The AFU
> + * @offset: The Offset from the start of MMIO
> + * @endian: the endianness that the MMIO data is in
> + * @val: The value to write
> + *
> + * Returns 0 for success, negative on error
> + */
> +int ocxl_global_mmio_write32(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u32 val);
> +
> +/**
> + * Write a 64 bit value to global MMIO
> + *
> + * @afu: The AFU
> + * @offset: The Offset from the start of MMIO
> + * @endian: the endianness that the MMIO data is in
> + * @val: The value to write
> + *
> + * Returns 0 for success, negative on error
> + */
> +int ocxl_global_mmio_write64(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u64 val);
> +
> +/**
> + * Set bits in a 32 bit global MMIO register
> + *
> + * @afu: The AFU
> + * @offset: The Offset from the start of MMIO
> + * @endian: the endianness that the MMIO data is in
> + * @mask: a mask of the bits to set
> + *
> + * Returns 0 for success, negative on error
> + */
> +int ocxl_global_mmio_set32(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u32 mask);
> +
> +/**
> + * Set bits in a 64 bit global MMIO register
> + *
> + * @afu: The AFU
> + * @offset: The Offset from the start of MMIO
> + * @endian: the endianness that the MMIO data is in
> + * @mask: a mask of the bits to set
> + *
> + * Returns 0 for success, negative on error
> + */
> +int ocxl_global_mmio_set64(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u64 mask);
> +
> +/**
> + * Set bits in a 32 bit global MMIO register
> + *
> + * @afu: The AFU
> + * @offset: The Offset from the start of MMIO
> + * @endian: the endianness that the MMIO data is in
> + * @mask: a mask of the bits to set
> + *
> + * Returns 0 for success, negative on error
> + */
> +int ocxl_global_mmio_clear32(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u32 mask);
> +
> +/**
> + * Set bits in a 64 bit global MMIO register
> + *
> + * @afu: The AFU
> + * @offset: The Offset from the start of MMIO
> + * @endian: the endianness that the MMIO data is in
> + * @mask: a mask of the bits to set
> + *
> + * Returns 0 for success, negative on error
> + */
> +int ocxl_global_mmio_clear64(struct ocxl_afu *afu, size_t offset,
> + enum ocxl_endian endian, u64 mask);
> +
> /*
> * Read the configuration space of a function and fill in a
> * ocxl_fn_config structure with all the function details
>
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com IBM Australia Limited
^ permalink raw reply
* Re: [PATCH 4/7] ocxl: Don't pass pci_dev around
From: Andrew Donnellan @ 2019-03-15 3:32 UTC (permalink / raw)
To: Alastair D'Silva
Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel,
Alastair D'Silva, Frederic Barrat, linuxppc-dev
In-Reply-To: <20190313041524.14644-5-alastair@au1.ibm.com>
On 13/3/19 3:15 pm, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> This data is already available in a struct
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
This is a good idea.
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---
> drivers/misc/ocxl/core.c | 38 +++++++++++++++++++++-----------------
> 1 file changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/misc/ocxl/core.c b/drivers/misc/ocxl/core.c
> index b47cfda83e46..2fd0c700e8a0 100644
> --- a/drivers/misc/ocxl/core.c
> +++ b/drivers/misc/ocxl/core.c
> @@ -66,10 +66,11 @@ static int set_afu_device(struct ocxl_afu *afu, const char *location)
> return rc;
> }
>
> -static int assign_afu_actag(struct ocxl_afu *afu, struct pci_dev *dev)
> +static int assign_afu_actag(struct ocxl_afu *afu)
> {
> struct ocxl_fn *fn = afu->fn;
> int actag_count, actag_offset;
> + struct pci_dev *pci_dev = to_pci_dev(fn->dev.parent);
>
> /*
> * if there were not enough actags for the function, each afu
> @@ -79,16 +80,16 @@ static int assign_afu_actag(struct ocxl_afu *afu, struct pci_dev *dev)
> fn->actag_enabled / fn->actag_supported;
> actag_offset = ocxl_actag_afu_alloc(fn, actag_count);
> if (actag_offset < 0) {
> - dev_err(&afu->dev, "Can't allocate %d actags for AFU: %d\n",
> + dev_err(&pci_dev->dev, "Can't allocate %d actags for AFU: %d\n",
> actag_count, actag_offset);
> return actag_offset;
> }
> afu->actag_base = fn->actag_base + actag_offset;
> afu->actag_enabled = actag_count;
>
> - ocxl_config_set_afu_actag(dev, afu->config.dvsec_afu_control_pos,
> + ocxl_config_set_afu_actag(pci_dev, afu->config.dvsec_afu_control_pos,
> afu->actag_base, afu->actag_enabled);
> - dev_dbg(&afu->dev, "actag base=%d enabled=%d\n",
> + dev_dbg(&pci_dev->dev, "actag base=%d enabled=%d\n",
> afu->actag_base, afu->actag_enabled);
> return 0;
> }
> @@ -103,10 +104,11 @@ static void reclaim_afu_actag(struct ocxl_afu *afu)
> ocxl_actag_afu_free(afu->fn, start_offset, size);
> }
>
> -static int assign_afu_pasid(struct ocxl_afu *afu, struct pci_dev *dev)
> +static int assign_afu_pasid(struct ocxl_afu *afu)
> {
> struct ocxl_fn *fn = afu->fn;
> int pasid_count, pasid_offset;
> + struct pci_dev *pci_dev = to_pci_dev(fn->dev.parent);
>
> /*
> * We only support the case where the function configuration
> @@ -115,7 +117,7 @@ static int assign_afu_pasid(struct ocxl_afu *afu, struct pci_dev *dev)
> pasid_count = 1 << afu->config.pasid_supported_log;
> pasid_offset = ocxl_pasid_afu_alloc(fn, pasid_count);
> if (pasid_offset < 0) {
> - dev_err(&afu->dev, "Can't allocate %d PASIDs for AFU: %d\n",
> + dev_err(&pci_dev->dev, "Can't allocate %d PASIDs for AFU: %d\n",
> pasid_count, pasid_offset);
> return pasid_offset;
> }
> @@ -123,10 +125,10 @@ static int assign_afu_pasid(struct ocxl_afu *afu, struct pci_dev *dev)
> afu->pasid_count = 0;
> afu->pasid_max = pasid_count;
>
> - ocxl_config_set_afu_pasid(dev, afu->config.dvsec_afu_control_pos,
> + ocxl_config_set_afu_pasid(pci_dev, afu->config.dvsec_afu_control_pos,
> afu->pasid_base,
> afu->config.pasid_supported_log);
> - dev_dbg(&afu->dev, "PASID base=%d, enabled=%d\n",
> + dev_dbg(&pci_dev->dev, "PASID base=%d, enabled=%d\n",
> afu->pasid_base, pasid_count);
> return 0;
> }
> @@ -172,9 +174,10 @@ static void release_fn_bar(struct ocxl_fn *fn, int bar)
> WARN_ON(fn->bar_used[idx] < 0);
> }
>
> -static int map_mmio_areas(struct ocxl_afu *afu, struct pci_dev *dev)
> +static int map_mmio_areas(struct ocxl_afu *afu)
> {
> int rc;
> + struct pci_dev *pci_dev = to_pci_dev(afu->fn->dev.parent);
>
> rc = reserve_fn_bar(afu->fn, afu->config.global_mmio_bar);
> if (rc)
> @@ -187,10 +190,10 @@ static int map_mmio_areas(struct ocxl_afu *afu, struct pci_dev *dev)
> }
>
> afu->global_mmio_start =
> - pci_resource_start(dev, afu->config.global_mmio_bar) +
> + pci_resource_start(pci_dev, afu->config.global_mmio_bar) +
> afu->config.global_mmio_offset;
> afu->pp_mmio_start =
> - pci_resource_start(dev, afu->config.pp_mmio_bar) +
> + pci_resource_start(pci_dev, afu->config.pp_mmio_bar) +
> afu->config.pp_mmio_offset;
>
> afu->global_mmio_ptr = ioremap(afu->global_mmio_start,
> @@ -198,7 +201,7 @@ static int map_mmio_areas(struct ocxl_afu *afu, struct pci_dev *dev)
> if (!afu->global_mmio_ptr) {
> release_fn_bar(afu->fn, afu->config.pp_mmio_bar);
> release_fn_bar(afu->fn, afu->config.global_mmio_bar);
> - dev_err(&dev->dev, "Error mapping global mmio area\n");
> + dev_err(&pci_dev->dev, "Error mapping global mmio area\n");
> return -ENOMEM;
> }
>
> @@ -234,17 +237,17 @@ static int configure_afu(struct ocxl_afu *afu, u8 afu_idx, struct pci_dev *dev)
> if (rc)
> return rc;
>
> - rc = assign_afu_actag(afu, dev);
> + rc = assign_afu_actag(afu);
> if (rc)
> return rc;
>
> - rc = assign_afu_pasid(afu, dev);
> + rc = assign_afu_pasid(afu);
> if (rc) {
> reclaim_afu_actag(afu);
> return rc;
> }
>
> - rc = map_mmio_areas(afu, dev);
> + rc = map_mmio_areas(afu);
> if (rc) {
> reclaim_afu_pasid(afu);
> reclaim_afu_actag(afu);
> @@ -331,7 +334,7 @@ void remove_afu(struct ocxl_afu *afu)
> device_unregister(&afu->dev);
> }
>
> -static struct ocxl_fn *alloc_function(struct pci_dev *dev)
> +static struct ocxl_fn *alloc_function(void)
> {
> struct ocxl_fn *fn;
>
> @@ -342,6 +345,7 @@ static struct ocxl_fn *alloc_function(struct pci_dev *dev)
> INIT_LIST_HEAD(&fn->afu_list);
> INIT_LIST_HEAD(&fn->pasid_list);
> INIT_LIST_HEAD(&fn->actag_list);
> +
> return fn;
> }
>
> @@ -491,7 +495,7 @@ struct ocxl_fn *init_function(struct pci_dev *dev)
> struct ocxl_fn *fn;
> int rc;
>
> - fn = alloc_function(dev);
> + fn = alloc_function();
> if (!fn)
> return ERR_PTR(-ENOMEM);
>
>
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com IBM Australia Limited
^ permalink raw reply
* Re: [PATCH v6 4/4] hugetlb: allow to free gigantic pages regardless of the configuration
From: Aneesh Kumar K.V @ 2019-03-15 2:57 UTC (permalink / raw)
To: Alexandre Ghiti, Andrew Morton, Vlastimil Babka, Catalin Marinas,
Will Deacon, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, Martin Schwidefsky, Heiko Carstens,
Yoshinori Sato, Rich Felker, David S . Miller, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, H . Peter Anvin, x86, Dave Hansen,
Andy Lutomirski, Peter Zijlstra, Mike Kravetz, linux-arm-kernel,
linux-kernel, linuxppc-dev, linux-s390, linux-sh, sparclinux,
linux-mm
In-Reply-To: <b6259684-ddc0-ade4-1881-016b5e7fff66@ghiti.fr>
On 3/14/19 7:22 PM, Alexandre Ghiti wrote:
>
>
> On 03/14/2019 02:17 PM, Aneesh Kumar K.V wrote:
>> On 3/14/19 5:13 PM, Alexandre Ghiti wrote:
>>> On 03/14/2019 06:52 AM, Aneesh Kumar K.V wrote:
>>>> Alexandre Ghiti <alex@ghiti.fr> writes:
>>>>
>>
>>> Thanks for noticing Aneesh.
>>>
>>> I can't find a better solution than bringing back
>>> gigantic_page_supported check,
>>> since it is must be done at runtime in your case.
>>> I'm not sure of one thing though: you say that freeing boottime
>>> gigantic pages
>>> is not needed, but is it forbidden ? Just to know where the check and
>>> what its
>>> new name should be.
>
> You did not answer this question: is freeing boottime gigantic pages
> "forbidden" or just
> not needed ?
IMHO if we don't allow runtime allocation of gigantic hugepage, we
should not allow runtime free of gigantic hugepage. Now w.r.t ppc64,
hypervisor pass hints about the gignatic hugepages via device tree
nodes. Early in boot we mark these pages as reserved and during hugetlb
init we use these reserved pages for backing hugetlb fs.
Now "forbidden" is not the exact reason. We don't have code to put it
back in the reserved list. Hence I would say "not supported".
-aneesh
^ permalink raw reply
* [PATCH] crypto: vmx - fix copy-paste error in CTR mode
From: Daniel Axtens @ 2019-03-15 2:09 UTC (permalink / raw)
To: omosnacek, linux-crypto, Herbert Xu
Cc: leo.barbosa, Stephan Mueller, nayna, leitao, pfsmorigo,
marcelo.cerri, linuxppc-dev
The original assembly imported from OpenSSL has two copy-paste
errors in handling CTR mode. When dealing with a 2 or 3 block tail,
the code branches to the CBC decryption exit path, rather than to
the CTR exit path.
This leads to corruption of the IV, which leads to subsequent blocks
being corrupted.
This can be detected with libkcapi test suite, which is available at
https://github.com/smuellerDD/libkcapi
Reported-by: Ondrej Mosnáček <omosnacek@gmail.com>
Fixes: 5c380d623ed3 ("crypto: vmx - Add support for VMS instructions by ASM")
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Axtens <dja@axtens.net>
---
drivers/crypto/vmx/aesp8-ppc.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl
index d6a9f63d65ba..de78282b8f44 100644
--- a/drivers/crypto/vmx/aesp8-ppc.pl
+++ b/drivers/crypto/vmx/aesp8-ppc.pl
@@ -1854,7 +1854,7 @@ Lctr32_enc8x_three:
stvx_u $out1,$x10,$out
stvx_u $out2,$x20,$out
addi $out,$out,0x30
- b Lcbc_dec8x_done
+ b Lctr32_enc8x_done
.align 5
Lctr32_enc8x_two:
@@ -1866,7 +1866,7 @@ Lctr32_enc8x_two:
stvx_u $out0,$x00,$out
stvx_u $out1,$x10,$out
addi $out,$out,0x20
- b Lcbc_dec8x_done
+ b Lctr32_enc8x_done
.align 5
Lctr32_enc8x_one:
--
2.19.1
^ permalink raw reply related
* Re: BUG: p8_aes_ctr randomly returns wrong results
From: Daniel Axtens @ 2019-03-15 1:26 UTC (permalink / raw)
To: Ondrej Mosnáček, linux-crypto, Herbert Xu
Cc: marcelo.cerri, Stephan Mueller, leo.barbosa, linuxppc-dev,
Paulo Flabiano Smorigo
In-Reply-To: <CAAUqJDtsx6Sdv=6xAb1VWWjDF08y8wh2nsAypR8_x_e99a1Uwg@mail.gmail.com>
Hi Ondrej,
> When I run 'rmmod vmx_crypto' before running the reproducer, I get
> only one (correct) checksum, so this is definitely a bug in the
> driver. Other ciphers (cbc(aes), xts(aes)) are not affected, even
> though the glue code is very similar. That leads me to believe the
> problem is somewhere in the assembly code.
It appears that under certain circumstances, aes_p8_ctr32_encrypt_blocks
changes walk.iv. If this is done when
while ((nbytes = walk.nbytes) >= AES_BLOCK_SIZE) {
is not in its final iteration, it will corrupt the future blocks.
I am not yet sure why this is. Clearly it's pretty late in the assembly
because it doesn't seem to affect the blocks being processed in that
call, only future calls.
Saving and restoring the IV makes the test case pass.
I'll have a look at the asm.
Regards,
Daniel
>
> [1] http://github.com/smuellerDD/libkcapi
>
> Cheers,
> Ondrej
^ permalink raw reply
* [PATCH] powerpc/powernv: Add mmap to opal export sysfs nodes
From: Jordan Niethe @ 2019-03-15 0:54 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Jordan Niethe
The sysfs nodes created under /opal/exports/ do not currently support
mmap. Skiboot trace buffers are not yet added to this location but
this is a suitable for them to be exported to. Adding mmap support makes
using these trace buffers more convenient. The state in the header of
the trace buffer is needed to ensure the read position has not been
overwritten. Thus the header of the buffer must be read, then the
read position itself. Using lseek/read to do this introduces a delay
that could result in incorrect reads if the read position is overwritten
after the header is read.
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
---
arch/powerpc/platforms/powernv/opal.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 2b0eca104f86..3cfc683bb060 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -714,6 +714,15 @@ static ssize_t export_attr_read(struct file *fp, struct kobject *kobj,
bin_attr->size);
}
+static int export_attr_mmap(struct file *fp, struct kobject *kobj,
+ struct bin_attribute *attr,
+ struct vm_area_struct *vma)
+{
+ return remap_pfn_range(vma, vma->vm_start,
+ __pa(attr->private) >> PAGE_SHIFT,
+ attr->size, PAGE_READONLY);
+}
+
/*
* opal_export_attrs: creates a sysfs node for each property listed in
* the device-tree under /ibm,opal/firmware/exports/
@@ -759,6 +768,7 @@ static void opal_export_attrs(void)
attr->attr.name = kstrdup(prop->name, GFP_KERNEL);
attr->attr.mode = 0400;
attr->read = export_attr_read;
+ attr->mmap = export_attr_mmap;
attr->private = __va(vals[0]);
attr->size = vals[1];
--
2.20.1
^ permalink raw reply related
* Re: [PATCH 13/38] vfs: Convert cxl to fs_context
From: Andrew Donnellan @ 2019-03-15 0:22 UTC (permalink / raw)
To: David Howells, viro
Cc: linux-fsdevel, Frederic Barrat, linuxppc-dev, linux-kernel
In-Reply-To: <155257984031.13720.1656009200478611751.stgit@warthog.procyon.org.uk>
On 15/3/19 3:10 am, David Howells wrote:
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Frederic Barrat <fbarrat@linux.ibm.com>
> cc: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> cc: linuxppc-dev@lists.ozlabs.org
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---
>
> drivers/misc/cxl/api.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
> index 750470ef2049..395e9a88e6ba 100644
> --- a/drivers/misc/cxl/api.c
> +++ b/drivers/misc/cxl/api.c
> @@ -13,6 +13,7 @@
> #include <misc/cxl.h>
> #include <linux/module.h>
> #include <linux/mount.h>
> +#include <linux/fs_context.h>
> #include <linux/sched/mm.h>
> #include <linux/mmu_context.h>
>
> @@ -41,17 +42,16 @@ static const struct dentry_operations cxl_fs_dops = {
> .d_dname = simple_dname,
> };
>
> -static struct dentry *cxl_fs_mount(struct file_system_type *fs_type, int flags,
> - const char *dev_name, void *data)
> +static int cxl_fs_init_fs_context(struct fs_context *fc)
> {
> - return mount_pseudo(fs_type, "cxl:", NULL, &cxl_fs_dops,
> - CXL_PSEUDO_FS_MAGIC);
> + return vfs_init_pseudo_fs_context(fc, "cxl:", NULL, NULL,
> + &cxl_fs_dops, CXL_PSEUDO_FS_MAGIC);
> }
>
> static struct file_system_type cxl_fs_type = {
> .name = "cxl",
> .owner = THIS_MODULE,
> - .mount = cxl_fs_mount,
> + .init_fs_context = cxl_fs_init_fs_context,
> .kill_sb = kill_anon_super,
> };
>
>
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com IBM Australia Limited
^ permalink raw reply
* Re: [PATCH v2 10/45] drivers: tty: serial: zs: use devm_* functions
From: Greg KH @ 2019-03-14 22:52 UTC (permalink / raw)
To: Enrico Weigelt, metux IT consult
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, slemieux.tyco, andy.gross, tklauser, david.brown,
rjui, s.hauer, u.kleine-koenig, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud,
linuxppc-dev, linux-kernel, kernel, shawnguo
In-Reply-To: <1552602855-26086-11-git-send-email-info@metux.net>
On Thu, Mar 14, 2019 at 11:33:40PM +0100, Enrico Weigelt, metux IT consult wrote:
> Use the safer devm versions of memory mapping functions.
What is "safer" about them?
>
> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
> ---
> drivers/tty/serial/zs.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/tty/serial/zs.c b/drivers/tty/serial/zs.c
> index b03d3e4..0b1ec2f 100644
> --- a/drivers/tty/serial/zs.c
> +++ b/drivers/tty/serial/zs.c
> @@ -984,16 +984,17 @@ static const char *zs_type(struct uart_port *uport)
>
> static void zs_release_port(struct uart_port *uport)
> {
> - iounmap(uport->membase);
> + devm_iounmap(uport->dev, uport->membase);
> uport->membase = 0;
> - release_mem_region(uport->mapbase, ZS_CHAN_IO_SIZE);
> + devm_release_mem_region(uport->dev, uport->mapbase, ZS_CHAN_IO_SIZE);
Isn't the whole goal of the devm* functions such that you are not
required to call "release" on them?
If so, are you sure this patchset is correct?
And also, why make the change, you aren't changing any functionality for
these old drivers at all from what I can tell (for the devm calls).
What am I missing here?
thanks,
greg k-h
^ permalink raw reply
* [PATCH v2 25/45] drivers: tty: serial: pxa: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:33 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/pxa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 4932b67..9512a9f 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -892,7 +892,7 @@ static int serial_pxa_probe(struct platform_device *dev)
}
snprintf(sport->name, PXA_NAME_LEN - 1, "UART%d", sport->port.line + 1);
- sport->port.membase = ioremap(mmres->start, resource_size(mmres));
+ sport->port.membase = devm_ioremap_resource(sport->port.dev, mmres);
if (!sport->port.membase) {
ret = -ENOMEM;
goto err_clk;
--
1.9.1
^ permalink raw reply related
* [PATCH v2 45/45] drivers: tty: serial: mux: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:34 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/mux.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/mux.c b/drivers/tty/serial/mux.c
index 00ce31e..cd08f0f 100644
--- a/drivers/tty/serial/mux.c
+++ b/drivers/tty/serial/mux.c
@@ -456,8 +456,9 @@ static int __init mux_probe(struct parisc_device *dev)
printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.6\n", port_count);
dev_set_drvdata(&dev->dev, (void *)(long)port_count);
- request_mem_region(dev->hpa.start + MUX_OFFSET,
- port_count * MUX_LINE_OFFSET, "Mux");
+ devm_request_mem_region(&dev->dev,
+ dev->hpa.start + MUX_OFFSET,
+ port_count * MUX_LINE_OFFSET, "Mux");
if(!port_cnt) {
mux_driver.cons = MUX_CONSOLE;
@@ -474,7 +475,9 @@ static int __init mux_probe(struct parisc_device *dev)
port->iobase = 0;
port->mapbase = dev->hpa.start + MUX_OFFSET +
(i * MUX_LINE_OFFSET);
- port->membase = ioremap_nocache(port->mapbase, MUX_LINE_OFFSET);
+ port->membase = devm_ioremap_nocache(port->dev,
+ port->mapbase,
+ MUX_LINE_OFFSET);
port->iotype = UPIO_MEM;
port->type = PORT_MUX;
port->irq = 0;
@@ -517,10 +520,12 @@ static int __exit mux_remove(struct parisc_device *dev)
uart_remove_one_port(&mux_driver, port);
if(port->membase)
- iounmap(port->membase);
+ devm_iounmap(port->dev, port->membase);
}
- release_mem_region(dev->hpa.start + MUX_OFFSET, port_count * MUX_LINE_OFFSET);
+ devm_release_mem_region(&dev->dev,
+ dev->hpa.start + MUX_OFFSET,
+ port_count * MUX_LINE_OFFSET);
return 0;
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2 15/45] drivers: tty: serial: uartlite: use dev_err() instead of printk()
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:33 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Using dev_err() instead of printk() for more consistent output.
(prints device name, etc).
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/uartlite.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index b8b912b..aa461b8 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -352,7 +352,7 @@ static int ulite_request_port(struct uart_port *port)
struct uartlite_data *pdata = port->private_data;
int ret;
- pr_debug("ulite console: port=%p; port->mapbase=%llx\n",
+ dev_dbg(port->dev, "ulite console: port=%p; port->mapbase=%llx\n",
port, (unsigned long long) port->mapbase);
if (!request_mem_region(port->mapbase, ULITE_REGION, "uartlite")) {
@@ -519,7 +519,7 @@ static int ulite_console_setup(struct console *co, char *options)
/* Has the device been initialized yet? */
if (!port->mapbase) {
- pr_debug("console on ttyUL%i not present\n", co->index);
+ dev_dbg(port->dev, "console on ttyUL%i not present\n", co->index);
return -ENODEV;
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2 31/45] drivers: tty: serial: amba-pl011: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:34 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/amba-pl011.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 89ade21..2a968b2 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2098,7 +2098,7 @@ static const char *pl011_type(struct uart_port *port)
*/
static void pl011_release_port(struct uart_port *port)
{
- release_mem_region(port->mapbase, SZ_4K);
+ devm_release_mem_region(port->dev, port->mapbase, SZ_4K);
}
/*
@@ -2106,7 +2106,10 @@ static void pl011_release_port(struct uart_port *port)
*/
static int pl011_request_port(struct uart_port *port)
{
- return request_mem_region(port->mapbase, SZ_4K, "uart-pl011")
+ return devm_request_mem_region(port->dev,
+ port->mapbase,
+ SZ_4K,
+ "uart-pl011")
!= NULL ? 0 : -EBUSY;
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2 39/45] drivers: tty: serial: efm32-uart: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:34 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/efm32-uart.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c
index d6b5e54..a79cadc 100644
--- a/drivers/tty/serial/efm32-uart.c
+++ b/drivers/tty/serial/efm32-uart.c
@@ -437,7 +437,7 @@ static void efm32_uart_release_port(struct uart_port *port)
clk_unprepare(efm_port->clk);
clk_put(efm_port->clk);
- iounmap(port->membase);
+ devm_iounmap(port->dev, port->membase);
}
static int efm32_uart_request_port(struct uart_port *port)
@@ -445,7 +445,7 @@ static int efm32_uart_request_port(struct uart_port *port)
struct efm32_uart_port *efm_port = to_efm_port(port);
int ret;
- port->membase = ioremap(port->mapbase, 60);
+ port->membase = devm_ioremap(port->dev, port->mapbase, 60);
if (!efm_port->port.membase) {
ret = -ENOMEM;
efm_debug(efm_port, "failed to remap\n");
@@ -464,7 +464,7 @@ static int efm32_uart_request_port(struct uart_port *port)
clk_put(efm_port->clk);
err_clk_get:
- iounmap(port->membase);
+ devm_iounmap(port->dev, port->membase);
err_ioremap:
return ret;
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2 30/45] drivers: tty: serial: serial_ks8695: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:34 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
---
drivers/tty/serial/serial_ks8695.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/serial_ks8695.c b/drivers/tty/serial/serial_ks8695.c
index b461d79..f901eea 100644
--- a/drivers/tty/serial/serial_ks8695.c
+++ b/drivers/tty/serial/serial_ks8695.c
@@ -482,7 +482,7 @@ static const char *ks8695uart_type(struct uart_port *port)
*/
static void ks8695uart_release_port(struct uart_port *port)
{
- release_mem_region(port->mapbase, UART_PORT_SIZE);
+ devm_release_mem_region(port->dev, port->mapbase, UART_PORT_SIZE);
}
/*
@@ -490,7 +490,9 @@ static void ks8695uart_release_port(struct uart_port *port)
*/
static int ks8695uart_request_port(struct uart_port *port)
{
- return request_mem_region(port->mapbase, UART_PORT_SIZE,
+ return devm_request_mem_region(port->dev,
+ port->mapbase,
+ UART_PORT_SIZE,
"serial_ks8695") != NULL ? 0 : -EBUSY;
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2 41/45] drivers: tty: serial: timuart: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:34 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/men_z135_uart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/men_z135_uart.c b/drivers/tty/serial/men_z135_uart.c
index ef89534..349f70e 100644
--- a/drivers/tty/serial/men_z135_uart.c
+++ b/drivers/tty/serial/men_z135_uart.c
@@ -732,7 +732,7 @@ static void men_z135_release_port(struct uart_port *port)
{
struct men_z135_port *uart = to_men_z135(port);
- iounmap(port->membase);
+ devm_iounmap(port->dev, port->membase);
port->membase = NULL;
mcb_release_mem(uart->mem);
@@ -751,7 +751,7 @@ static int men_z135_request_port(struct uart_port *port)
port->mapbase = mem->start;
uart->mem = mem;
- port->membase = ioremap(mem->start, resource_size(mem));
+ port->membase = devm_ioremap_resource(port->dev, mem);
if (port->membase == NULL) {
mcb_release_mem(mem);
return -ENOMEM;
--
1.9.1
^ permalink raw reply related
* [PATCH v2 44/45] drivers: tty: serial: pnx8xxx_uart: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:34 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/pnx8xxx_uart.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/pnx8xxx_uart.c b/drivers/tty/serial/pnx8xxx_uart.c
index 223a949..3951226 100644
--- a/drivers/tty/serial/pnx8xxx_uart.c
+++ b/drivers/tty/serial/pnx8xxx_uart.c
@@ -568,10 +568,7 @@ static const char *pnx8xxx_type(struct uart_port *port)
*/
static void pnx8xxx_release_port(struct uart_port *port)
{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
-
- release_mem_region(sport->port.mapbase, UART_PORT_SIZE);
+ devm_release_mem_region(port->dev, port->mapbase, UART_PORT_SIZE);
}
/*
@@ -579,9 +576,7 @@ static void pnx8xxx_release_port(struct uart_port *port)
*/
static int pnx8xxx_request_port(struct uart_port *port)
{
- struct pnx8xxx_port *sport =
- container_of(port, struct pnx8xxx_port, port);
- return request_mem_region(sport->port.mapbase, UART_PORT_SIZE,
+ return devm_request_mem_region(port->dev, port->mapbase, UART_PORT_SIZE,
"pnx8xxx-uart") != NULL ? 0 : -EBUSY;
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2 32/45] drivers: tty: serial: atmel_serial: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:34 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/atmel_serial.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 05147fe..084f106 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2389,10 +2389,10 @@ static void atmel_release_port(struct uart_port *port)
struct platform_device *mpdev = to_platform_device(port->dev->parent);
int size = resource_size(mpdev->resource);
- release_mem_region(port->mapbase, size);
+ devm_release_mem_region(port->dev, port->mapbase, size);
if (port->flags & UPF_IOREMAP) {
- iounmap(port->membase);
+ devm_iounmap(port->dev, port->membase);
port->membase = NULL;
}
}
@@ -2405,13 +2405,16 @@ static int atmel_request_port(struct uart_port *port)
struct platform_device *mpdev = to_platform_device(port->dev->parent);
int size = resource_size(mpdev->resource);
- if (!request_mem_region(port->mapbase, size, "atmel_serial"))
+ if (!devm_request_mem_region(port->dev,
+ port->mapbase,
+ size,
+ "atmel_serial"))
return -EBUSY;
if (port->flags & UPF_IOREMAP) {
- port->membase = ioremap(port->mapbase, size);
+ port->membase = devm_ioremap(port->dev, port->mapbase, size);
if (port->membase == NULL) {
- release_mem_region(port->mapbase, size);
+ devm_release_mem_region(port->dev, port->mapbase, size);
return -ENOMEM;
}
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2 34/45] drivers: tty: serial: sb1250-duart: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:34 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/sb1250-duart.c | 42 +++++++++++++++++++++++++--------------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index 655961c..e77eef6 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -651,14 +651,18 @@ static void sbd_release_port(struct uart_port *uport)
struct sbd_port *sport = to_sport(uport);
struct sbd_duart *duart = sport->duart;
- iounmap(sport->memctrl);
+ devm_iounmap(uport->dev, sport->memctrl);
sport->memctrl = NULL;
- iounmap(uport->membase);
+ devm_iounmap(uport->dev, uport->membase);
uport->membase = NULL;
if(refcount_dec_and_test(&duart->map_guard))
- release_mem_region(duart->mapctrl, DUART_CHANREG_SPACING);
- release_mem_region(uport->mapbase, DUART_CHANREG_SPACING);
+ devm_release_mem_region(uport->dev,
+ duart->mapctrl,
+ DUART_CHANREG_SPACING);
+ devm_release_mem_region(uport->dev,
+ uport->mapbase,
+ DUART_CHANREG_SPACING);
}
static int sbd_map_port(struct uart_port *uport)
@@ -667,19 +671,21 @@ static int sbd_map_port(struct uart_port *uport)
struct sbd_duart *duart = sport->duart;
if (!uport->membase)
- uport->membase = ioremap_nocache(uport->mapbase,
- DUART_CHANREG_SPACING);
+ uport->membase = devm_ioremap_nocache(uport->dev,
+ uport->mapbase,
+ DUART_CHANREG_SPACING);
if (!uport->membase) {
dev_err(uport->dev, "Cannot map MMIO (base)\n");
return -ENOMEM;
}
if (!sport->memctrl)
- sport->memctrl = ioremap_nocache(duart->mapctrl,
- DUART_CHANREG_SPACING);
+ sport->memctrl = devm_ioremap_nocache(uport->dev,
+ duart->mapctrl,
+ DUART_CHANREG_SPACING);
if (!sport->memctrl) {
dev_err(uport->dev, "Cannot map MMIO (ctrl)\n");
- iounmap(uport->membase);
+ devm_iounmap(uport->dev, uport->membase);
uport->membase = NULL;
return -ENOMEM;
}
@@ -693,15 +699,18 @@ static int sbd_request_port(struct uart_port *uport)
struct sbd_duart *duart = to_sport(uport)->duart;
int ret = 0;
- if (!request_mem_region(uport->mapbase, DUART_CHANREG_SPACING,
+ if (!devm_request_mem_region(uport->dev,
+ uport->mapbase, DUART_CHANREG_SPACING,
"sb1250-duart")) {
printk(err);
return -EBUSY;
}
refcount_inc(&duart->map_guard);
if (refcount_read(&duart->map_guard) == 1) {
- if (!request_mem_region(duart->mapctrl, DUART_CHANREG_SPACING,
- "sb1250-duart")) {
+ if (!devm_request_mem_region(uport->dev,
+ duart->mapctrl,
+ DUART_CHANREG_SPACING,
+ "sb1250-duart")) {
refcount_dec(&duart->map_guard);
printk(err);
ret = -EBUSY;
@@ -711,12 +720,15 @@ static int sbd_request_port(struct uart_port *uport)
ret = sbd_map_port(uport);
if (ret) {
if (refcount_dec_and_test(&duart->map_guard))
- release_mem_region(duart->mapctrl,
- DUART_CHANREG_SPACING);
+ devm_release_mem_region(uport->dev,
+ duart->mapctrl,
+ DUART_CHANREG_SPACING);
}
}
if (ret) {
- release_mem_region(uport->mapbase, DUART_CHANREG_SPACING);
+ devm_release_mem_region(uport->dev,
+ uport->mapbase,
+ DUART_CHANREG_SPACING);
return ret;
}
return 0;
--
1.9.1
^ permalink raw reply related
* [PATCH v2 37/45] drivers: tty: serial: apbuart: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:34 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/apbuart.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 60cd133..5eaaee9 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -293,12 +293,15 @@ static const char *apbuart_type(struct uart_port *port)
static void apbuart_release_port(struct uart_port *port)
{
- release_mem_region(port->mapbase, 0x100);
+ devm_release_mem_region(port->dev, port->mapbase, 0x100);
}
static int apbuart_request_port(struct uart_port *port)
{
- return request_mem_region(port->mapbase, 0x100, "grlib-apbuart")
+ return devm_request_mem_region(port->dev,
+ port->mapbase,
+ 0x100,
+ "grlib-apbuart")
!= NULL ? 0 : -EBUSY;
return 0;
}
@@ -622,7 +625,9 @@ static int __init grlib_apbuart_configure(void)
port = &grlib_apbuart_ports[line];
port->mapbase = addr;
- port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map));
+ port->membase = devm_ioremap(port->dev,
+ addr,
+ sizeof(struct grlib_apbuart_regs_map));
port->irq = 0;
port->iotype = UPIO_MEM;
port->ops = &grlib_apbuart_ops;
--
1.9.1
^ permalink raw reply related
* [PATCH v2 38/45] drivers: tty: serial: samsung: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:34 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/samsung.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index a49cf15..e0bab87 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1436,13 +1436,16 @@ static const char *s3c24xx_serial_type(struct uart_port *port)
static void s3c24xx_serial_release_port(struct uart_port *port)
{
- release_mem_region(port->mapbase, MAP_SIZE);
+ devm_release_mem_region(port->dev, port->mapbase, MAP_SIZE);
}
static int s3c24xx_serial_request_port(struct uart_port *port)
{
const char *name = s3c24xx_serial_portname(port);
- return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY;
+ return devm_request_mem_region(port->dev,
+ port->mapbase,
+ MAP_SIZE,
+ name) ? 0 : -EBUSY;
}
static void s3c24xx_serial_config_port(struct uart_port *port, int flags)
--
1.9.1
^ permalink raw reply related
* [PATCH v2 09/45] drivers: tty: serial: 8250_mtk: use devm_ioremap_resource()
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:33 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Instead of fetching out data from a struct resource for passing
it to devm_ioremap(), directly use devm_ioremap_resource()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/8250/8250_mtk.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index c1fdbc0..bf6eb8d 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -383,8 +383,7 @@ static int mtk8250_probe(struct platform_device *pdev)
return -EINVAL;
}
- uart.port.membase = devm_ioremap(&pdev->dev, regs->start,
- resource_size(regs));
+ uart.port.membase = devm_ioremap_resource(&pdev->dev, regs);
if (!uart.port.membase)
return -ENOMEM;
--
1.9.1
^ permalink raw reply related
* [PATCH v2 26/45] drivers: tty: serial: dz: use dev_err() instead of printk()
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:33 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Using dev_err() instead of printk() for more consistent output.
(prints device name, etc).
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/dz.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index 7b57e84..96e35af 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -416,7 +416,7 @@ static int dz_startup(struct uart_port *uport)
IRQF_SHARED, "dz", mux);
if (ret) {
atomic_add(-1, &mux->irq_guard);
- printk(KERN_ERR "dz: Cannot get IRQ %d!\n", dport->port.irq);
+ dev_err(uport->dev, "Cannot get IRQ %d!\n", dport->port.irq);
return ret;
}
@@ -680,7 +680,7 @@ static int dz_map_port(struct uart_port *uport)
uport->membase = ioremap_nocache(uport->mapbase,
dec_kn_slot_size);
if (!uport->membase) {
- printk(KERN_ERR "dz: Cannot map MMIO\n");
+ dev_err(uport->dev, "Cannot map MMIO\n");
return -ENOMEM;
}
return 0;
@@ -697,8 +697,8 @@ static int dz_request_port(struct uart_port *uport)
if (!request_mem_region(uport->mapbase, dec_kn_slot_size,
"dz")) {
atomic_add(-1, &mux->map_guard);
- printk(KERN_ERR
- "dz: Unable to reserve MMIO resource\n");
+ dev_err(uport->dev,
+ "Unable to reserve MMIO resource\n");
return -EBUSY;
}
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2 17/45] drivers: tty: serial: timuart: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:33 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/timbuart.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c
index 19d38b5..292354b 100644
--- a/drivers/tty/serial/timbuart.c
+++ b/drivers/tty/serial/timbuart.c
@@ -319,11 +319,11 @@ static void timbuart_release_port(struct uart_port *port)
resource_size(platform_get_resource(pdev, IORESOURCE_MEM, 0));
if (port->flags & UPF_IOREMAP) {
- iounmap(port->membase);
+ devm_iounmap(port->dev, port->membase);
port->membase = NULL;
}
- release_mem_region(port->mapbase, size);
+ devm_release_mem_region(port->dev, port->mapbase, size);
}
static int timbuart_request_port(struct uart_port *port)
@@ -332,13 +332,18 @@ static int timbuart_request_port(struct uart_port *port)
int size =
resource_size(platform_get_resource(pdev, IORESOURCE_MEM, 0));
- if (!request_mem_region(port->mapbase, size, "timb-uart"))
+ if (!devm_request_mem_region(port->dev,
+ port->mapbase,
+ size,
+ "timb-uart"))
return -EBUSY;
if (port->flags & UPF_IOREMAP) {
port->membase = ioremap(port->mapbase, size);
if (port->membase == NULL) {
- release_mem_region(port->mapbase, size);
+ devm-release_mem_region(port->dev,
+ port->mapbase,
+ size);
return -ENOMEM;
}
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2 20/45] drivers: tty: serial: msm_serial: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:33 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/msm_serial.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 1090960..e8e0c87 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -1324,8 +1324,8 @@ static void msm_release_port(struct uart_port *port)
return;
size = resource_size(uart_resource);
- release_mem_region(port->mapbase, size);
- iounmap(port->membase);
+ devm_release_mem_region(port->dev, port->mapbase, size);
+ devm_iounmap(port->dev, port->membase);
port->membase = NULL;
}
@@ -1342,10 +1342,13 @@ static int msm_request_port(struct uart_port *port)
size = resource_size(uart_resource);
- if (!request_mem_region(port->mapbase, size, "msm_serial"))
+ if (!devm_request_mem_region(port->dev,
+ port->mapbase,
+ size,
+ "msm_serial"))
return -EBUSY;
- port->membase = ioremap(port->mapbase, size);
+ port->membase = ioremap(port->dev, port->mapbase, size);
if (!port->membase) {
ret = -EBUSY;
goto fail_release_port;
@@ -1354,7 +1357,7 @@ static int msm_request_port(struct uart_port *port)
return 0;
fail_release_port:
- release_mem_region(port->mapbase, size);
+ devm_release_mem_region(port->dev, port->mapbase, size);
return ret;
}
--
1.9.1
^ permalink raw reply related
* [PATCH v2 19/45] drivers: tty: serial: sh-sci: use devm_* functions
From: Enrico Weigelt, metux IT consult @ 2019-03-14 22:33 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-msm, yamada.masahiro, macro, jacmet, festevam,
stefan.wahren, f.fainelli, bcm-kernel-feedback-list, linux-imx,
linux-serial, u.kleine-koenig, andy.gross, tklauser, david.brown,
rjui, s.hauer, slemieux.tyco, linuxppc-dev, vz, matthias.bgg,
andriy.shevchenko, baohua, sbranden, eric, richard.genoud, gregkh,
kernel, shawnguo
In-Reply-To: <1552602855-26086-1-git-send-email-info@metux.net>
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/sh-sci.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 060fcd4..e40b0d0 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2667,7 +2667,9 @@ static int sci_remap_port(struct uart_port *port)
return 0;
if (port->dev->of_node || (port->flags & UPF_IOREMAP)) {
- port->membase = ioremap_nocache(port->mapbase, sport->reg_size);
+ port->membase = devm_ioremap_nocache(port->dev,
+ port->mapbase,
+ sport->reg_size);
if (unlikely(!port->membase)) {
dev_err(port->dev, "can't remap port#%d\n", port->line);
return -ENXIO;
@@ -2689,11 +2691,11 @@ static void sci_release_port(struct uart_port *port)
struct sci_port *sport = to_sci_port(port);
if (port->dev->of_node || (port->flags & UPF_IOREMAP)) {
- iounmap(port->membase);
+ devm_iounmap(port->dev, port->membase);
port->membase = NULL;
}
- release_mem_region(port->mapbase, sport->reg_size);
+ devm_release_mem_region(port->dev, port->mapbase, sport->reg_size);
}
static int sci_request_port(struct uart_port *port)
@@ -2702,8 +2704,10 @@ static int sci_request_port(struct uart_port *port)
struct sci_port *sport = to_sci_port(port);
int ret;
- res = request_mem_region(port->mapbase, sport->reg_size,
- dev_name(port->dev));
+ res = devm_request_mem_region(port->dev,
+ port->mapbase,
+ sport->reg_size,
+ dev_name(port->dev));
if (unlikely(res == NULL)) {
dev_err(port->dev, "request_mem_region failed.");
return -EBUSY;
--
1.9.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox