* [PATCH v1] spi: nxp-fspi: Use min macro
@ 2024-08-27 8:57 Yan Zhen
2024-08-27 9:30 ` Bough Chen
2024-08-27 11:57 ` Michael Walle
0 siblings, 2 replies; 4+ messages in thread
From: Yan Zhen @ 2024-08-27 8:57 UTC (permalink / raw)
To: han.xu, haibo.chen, broonie
Cc: yogeshgaur.83, linux-spi, linux-kernel, opensource.kernel,
Yan Zhen
When the original file is guaranteed to contain the minmax.h header file
and compile correctly, using the real macro is usually
more intuitive and readable.
Signed-off-by: Yan Zhen <yanzhen@vivo.com>
---
drivers/spi/spi-nxp-fspi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 88397f712a3b..fda902aa5815 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -756,8 +756,7 @@ static int nxp_fspi_read_ahb(struct nxp_fspi *f, const struct spi_mem_op *op)
iounmap(f->ahb_addr);
f->memmap_start = start;
- f->memmap_len = len > NXP_FSPI_MIN_IOMAP ?
- len : NXP_FSPI_MIN_IOMAP;
+ f->memmap_len = max(len, NXP_FSPI_MIN_IOMAP);
f->ahb_addr = ioremap(f->memmap_phy + f->memmap_start,
f->memmap_len);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH v1] spi: nxp-fspi: Use min macro
2024-08-27 8:57 [PATCH v1] spi: nxp-fspi: Use min macro Yan Zhen
@ 2024-08-27 9:30 ` Bough Chen
2024-08-27 11:57 ` Michael Walle
1 sibling, 0 replies; 4+ messages in thread
From: Bough Chen @ 2024-08-27 9:30 UTC (permalink / raw)
To: Yan Zhen, Han Xu, broonie@kernel.org
Cc: yogeshgaur.83@gmail.com, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org, opensource.kernel@vivo.com
> -----Original Message-----
> From: Yan Zhen <yanzhen@vivo.com>
> Sent: 2024年8月27日 16:58
> To: Han Xu <han.xu@nxp.com>; Bough Chen <haibo.chen@nxp.com>;
> broonie@kernel.org
> Cc: yogeshgaur.83@gmail.com; linux-spi@vger.kernel.org;
> linux-kernel@vger.kernel.org; opensource.kernel@vivo.com; Yan Zhen
> <yanzhen@vivo.com>
> Subject: [PATCH v1] spi: nxp-fspi: Use min macro
>
> When the original file is guaranteed to contain the minmax.h header file and
> compile correctly, using the real macro is usually more intuitive and readable.
>
> Signed-off-by: Yan Zhen <yanzhen@vivo.com>
> ---
> drivers/spi/spi-nxp-fspi.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c index
> 88397f712a3b..fda902aa5815 100644
> --- a/drivers/spi/spi-nxp-fspi.c
> +++ b/drivers/spi/spi-nxp-fspi.c
> @@ -756,8 +756,7 @@ static int nxp_fspi_read_ahb(struct nxp_fspi *f, const
> struct spi_mem_op *op)
> iounmap(f->ahb_addr);
>
> f->memmap_start = start;
> - f->memmap_len = len > NXP_FSPI_MIN_IOMAP ?
> - len : NXP_FSPI_MIN_IOMAP;
> + f->memmap_len = max(len, NXP_FSPI_MIN_IOMAP);
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Thanks!
Haibo Chen
>
> f->ahb_addr = ioremap(f->memmap_phy + f->memmap_start,
> f->memmap_len);
> --
> 2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] spi: nxp-fspi: Use min macro
2024-08-27 8:57 [PATCH v1] spi: nxp-fspi: Use min macro Yan Zhen
2024-08-27 9:30 ` Bough Chen
@ 2024-08-27 11:57 ` Michael Walle
2024-08-31 12:21 ` David Laight
1 sibling, 1 reply; 4+ messages in thread
From: Michael Walle @ 2024-08-27 11:57 UTC (permalink / raw)
To: Yan Zhen, han.xu, haibo.chen, broonie
Cc: yogeshgaur.83, linux-spi, linux-kernel, opensource.kernel
[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]
Hi,
On Tue Aug 27, 2024 at 10:57 AM CEST, Yan Zhen wrote:
> When the original file is guaranteed to contain the minmax.h header file
> and compile correctly, using the real macro is usually
> more intuitive and readable.
The subject doesn't match what you're doing here. Also, shouldn't
one use max_t()?
-michael
>
> Signed-off-by: Yan Zhen <yanzhen@vivo.com>
> ---
> drivers/spi/spi-nxp-fspi.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
> index 88397f712a3b..fda902aa5815 100644
> --- a/drivers/spi/spi-nxp-fspi.c
> +++ b/drivers/spi/spi-nxp-fspi.c
> @@ -756,8 +756,7 @@ static int nxp_fspi_read_ahb(struct nxp_fspi *f, const struct spi_mem_op *op)
> iounmap(f->ahb_addr);
>
> f->memmap_start = start;
> - f->memmap_len = len > NXP_FSPI_MIN_IOMAP ?
> - len : NXP_FSPI_MIN_IOMAP;
> + f->memmap_len = max(len, NXP_FSPI_MIN_IOMAP);
>
> f->ahb_addr = ioremap(f->memmap_phy + f->memmap_start,
> f->memmap_len);
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH v1] spi: nxp-fspi: Use min macro
2024-08-27 11:57 ` Michael Walle
@ 2024-08-31 12:21 ` David Laight
0 siblings, 0 replies; 4+ messages in thread
From: David Laight @ 2024-08-31 12:21 UTC (permalink / raw)
To: 'Michael Walle', Yan Zhen, han.xu@nxp.com,
haibo.chen@nxp.com, broonie@kernel.org
Cc: yogeshgaur.83@gmail.com, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org, opensource.kernel@vivo.com
From: Michael Walle
> Sent: 27 August 2024 12:58
>
> Hi,
>
> On Tue Aug 27, 2024 at 10:57 AM CEST, Yan Zhen wrote:
> > When the original file is guaranteed to contain the minmax.h header file
> > and compile correctly, using the real macro is usually
> > more intuitive and readable.
>
> The subject doesn't match what you're doing here. Also, shouldn't
> one use max_t()?
You should pretty much never use max_t().
Using it is just an accident waiting to happen.
David
>
> -michael
>
> >
> > Signed-off-by: Yan Zhen <yanzhen@vivo.com>
> > ---
> > drivers/spi/spi-nxp-fspi.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
> > index 88397f712a3b..fda902aa5815 100644
> > --- a/drivers/spi/spi-nxp-fspi.c
> > +++ b/drivers/spi/spi-nxp-fspi.c
> > @@ -756,8 +756,7 @@ static int nxp_fspi_read_ahb(struct nxp_fspi *f, const struct spi_mem_op *op)
> > iounmap(f->ahb_addr);
> >
> > f->memmap_start = start;
> > - f->memmap_len = len > NXP_FSPI_MIN_IOMAP ?
> > - len : NXP_FSPI_MIN_IOMAP;
> > + f->memmap_len = max(len, NXP_FSPI_MIN_IOMAP);
> >
> > f->ahb_addr = ioremap(f->memmap_phy + f->memmap_start,
> > f->memmap_len);
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-31 12:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 8:57 [PATCH v1] spi: nxp-fspi: Use min macro Yan Zhen
2024-08-27 9:30 ` Bough Chen
2024-08-27 11:57 ` Michael Walle
2024-08-31 12:21 ` David Laight
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.