linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Alexander Sverdlin <alexander.sverdlin@nokia.com>,
	Dan Williams <dan.j.williams@intel.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH v1 1/1] range.h: Move resource API and constant to respective headers
Date: Thu, 13 Jul 2023 10:25:44 -0500	[thread overview]
Message-ID: <20230713152544.GA317144@bhelgaas> (raw)
In-Reply-To: <20230710131142.32284-1-andriy.shevchenko@linux.intel.com>

On Mon, Jul 10, 2023 at 04:11:42PM +0300, Andy Shevchenko wrote:
> range.h works with struct range data type. The resource_size_t
> is an alien here. Move the related pieces to the respective
> headers and rename MAX_RESOURCE using pattern ${TYPE}_MAX.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

No objection from me, although I might include more specifics in the
commit log, e.g., (1) move cap_resource() implementation into its only
user, and (2) rename and move RESOURCE_SIZE_MAX to limits.h.

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
>  arch/mips/cavium-octeon/setup.c | 2 +-
>  arch/x86/pci/amd_bus.c          | 8 ++++++++
>  arch/x86/pci/bus_numa.c         | 2 +-
>  include/linux/limits.h          | 2 ++
>  include/linux/range.h           | 8 --------
>  5 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
> index c5561016f577..1ad2602a0383 100644
> --- a/arch/mips/cavium-octeon/setup.c
> +++ b/arch/mips/cavium-octeon/setup.c
> @@ -1240,7 +1240,7 @@ static int __init octeon_no_pci_init(void)
>  	 */
>  	octeon_dummy_iospace = vzalloc(IO_SPACE_LIMIT);
>  	set_io_port_base((unsigned long)octeon_dummy_iospace);
> -	ioport_resource.start = MAX_RESOURCE;
> +	ioport_resource.start = RESOURCE_SIZE_MAX;
>  	ioport_resource.end = 0;
>  	return 0;
>  }
> diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
> index dd40d3fea74e..631512f7ec85 100644
> --- a/arch/x86/pci/amd_bus.c
> +++ b/arch/x86/pci/amd_bus.c
> @@ -51,6 +51,14 @@ static struct pci_root_info __init *find_pci_root_info(int node, int link)
>  	return NULL;
>  }
>  
> +static inline resource_size_t cap_resource(u64 val)
> +{
> +	if (val > RESOURCE_SIZE_MAX)
> +		return RESOURCE_SIZE_MAX;
> +
> +	return val;
> +}
> +
>  /**
>   * early_root_info_init()
>   * called before pcibios_scan_root and pci_scan_bus
> diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
> index 2752c02e3f0e..e4a525e59eaf 100644
> --- a/arch/x86/pci/bus_numa.c
> +++ b/arch/x86/pci/bus_numa.c
> @@ -101,7 +101,7 @@ void update_res(struct pci_root_info *info, resource_size_t start,
>  	if (start > end)
>  		return;
>  
> -	if (start == MAX_RESOURCE)
> +	if (start == RESOURCE_SIZE_MAX)
>  		return;
>  
>  	if (!merge)
> diff --git a/include/linux/limits.h b/include/linux/limits.h
> index f6bcc9369010..38eb7f6f7e88 100644
> --- a/include/linux/limits.h
> +++ b/include/linux/limits.h
> @@ -10,6 +10,8 @@
>  #define SSIZE_MAX	((ssize_t)(SIZE_MAX >> 1))
>  #define PHYS_ADDR_MAX	(~(phys_addr_t)0)
>  
> +#define RESOURCE_SIZE_MAX	((resource_size_t)~0)
> +
>  #define U8_MAX		((u8)~0U)
>  #define S8_MAX		((s8)(U8_MAX >> 1))
>  #define S8_MIN		((s8)(-S8_MAX - 1))
> diff --git a/include/linux/range.h b/include/linux/range.h
> index 7efb6a9b069b..6ad0b73cb7ad 100644
> --- a/include/linux/range.h
> +++ b/include/linux/range.h
> @@ -31,12 +31,4 @@ int clean_sort_range(struct range *range, int az);
>  
>  void sort_range(struct range *range, int nr_range);
>  
> -#define MAX_RESOURCE ((resource_size_t)~0)
> -static inline resource_size_t cap_resource(u64 val)
> -{
> -	if (val > MAX_RESOURCE)
> -		return MAX_RESOURCE;
> -
> -	return val;
> -}
>  #endif
> -- 
> 2.40.0.1.gaa8946217a0b
> 

      reply	other threads:[~2023-07-13 15:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 13:11 [PATCH v1 1/1] range.h: Move resource API and constant to respective headers Andy Shevchenko
2023-07-13 15:25 ` Bjorn Helgaas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230713152544.GA317144@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=alexander.sverdlin@nokia.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).