All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Shravan Kumar Ramani <shravankr@nvidia.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Vadim Pasternak <vadimp@nvidia.com>,
	 David Thompson <davthompson@nvidia.com>,
	 platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/4] platform/mellanox: mlxbf-pmc: Fix signed/unsigned mix-up
Date: Fri, 9 Feb 2024 17:08:20 +0200 (EET)	[thread overview]
Message-ID: <54ff990c-00a8-1854-02c6-e22b088fa3e7@linux.intel.com> (raw)
In-Reply-To: <366b8fc6f5d77c01f9e0e2ad25627df583729017.1707466888.git.shravankr@nvidia.com>

On Fri, 9 Feb 2024, Shravan Kumar Ramani wrote:

> Signed-off-by: Shravan Kumar Ramani <shravankr@nvidia.com>
> ---
>  drivers/platform/mellanox/mlxbf-pmc.c | 110 ++++++++++++++------------
>  1 file changed, 58 insertions(+), 52 deletions(-)
> 
> diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c
> index 71d919832e2a..e3f1ae772e43 100644
> --- a/drivers/platform/mellanox/mlxbf-pmc.c
> +++ b/drivers/platform/mellanox/mlxbf-pmc.c
> @@ -99,8 +99,8 @@
>   */
>  struct mlxbf_pmc_attribute {
>  	struct device_attribute dev_attr;
> -	int index;
> -	int nr;
> +	unsigned int index;
> +	unsigned int nr;
>  };
>  
>  /**
> @@ -121,7 +121,7 @@ struct mlxbf_pmc_block_info {
>  	void __iomem *mmio_base;
>  	size_t blk_size;
>  	size_t counters;
> -	int type;
> +	unsigned int type;
>  	struct mlxbf_pmc_attribute *attr_counter;
>  	struct mlxbf_pmc_attribute *attr_event;
>  	struct mlxbf_pmc_attribute attr_event_list;
> @@ -169,7 +169,7 @@ struct mlxbf_pmc_context {
>   * @evt_name: Name of the event
>   */
>  struct mlxbf_pmc_events {
> -	int evt_num;
> +	u32 evt_num;
>  	char *evt_name;
>  };
>  
> @@ -959,7 +959,7 @@ static int mlxbf_pmc_write(void __iomem *addr, int command, u64 value)
>  }
>  
>  /* Check if the register offset is within the mapped region for the block */
> -static bool mlxbf_pmc_valid_range(int blk_num, u32 offset)
> +static bool mlxbf_pmc_valid_range(unsigned int blk_num, u32 offset)
>  {
>  	if ((offset >= 0) && !(offset % MLXBF_PMC_REG_SIZE) &&
>  	    (offset + MLXBF_PMC_REG_SIZE <= pmc->block[blk_num].blk_size))
> @@ -970,7 +970,7 @@ static bool mlxbf_pmc_valid_range(int blk_num, u32 offset)
>  
>  /* Get the event list corresponding to a certain block */
>  static const struct mlxbf_pmc_events *mlxbf_pmc_event_list(const char *blk,
> -							   int *size)
> +							   unsigned int *size)

Usually size_t is the type that is preferred for sizes of memory blocks 
(including this case where it's array size that is just memory block 
size divided by another).

-- 
 i.


  reply	other threads:[~2024-02-09 15:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09  8:39 [PATCH v2 0/4] Updates to mlxbf-pmc Shravan Kumar Ramani
2024-02-09  8:39 ` [PATCH v2 1/4] platform/mellanox: mlxbf-pmc: Replace uintN_t with kernel-style types Shravan Kumar Ramani
2024-02-09 14:59   ` Ilpo Järvinen
2024-02-09  8:39 ` [PATCH v2 2/4] platform/mellanox: mlxbf-pmc: Fix signed/unsigned mix-up Shravan Kumar Ramani
2024-02-09 15:08   ` Ilpo Järvinen [this message]
2024-02-09  8:39 ` [PATCH v2 3/4] platform/mellanox: mlxbf-pmc: Add support for 64-bit counters and cycle count Shravan Kumar Ramani
2024-02-09  8:39 ` [PATCH v2 4/4] platform/mellanox: mlxbf-pmc: Add support for clock_measure performance block Shravan Kumar Ramani

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=54ff990c-00a8-1854-02c6-e22b088fa3e7@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=davthompson@nvidia.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=shravankr@nvidia.com \
    --cc=vadimp@nvidia.com \
    /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 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.