linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Vadim Pasternak <vadimp@mellanox.com>
Cc: Andy Shevchenko <andy@infradead.org>,
	Darren Hart <dvhart@infradead.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH platform-next v1 1/8] platform/mellanox: mlxreg-hotplug: Use capability register for attribute creation
Date: Thu, 9 Jul 2020 19:06:13 +0300	[thread overview]
Message-ID: <CAHp75VfFdf=ZxuURpVR6LRaDm+x4VQsPgR6FLrcZPhLMn8MOpw@mail.gmail.com> (raw)
In-Reply-To: <20200601091851.5491-2-vadimp@mellanox.com>

On Mon, Jun 1, 2020 at 12:19 PM Vadim Pasternak <vadimp@mellanox.com> wrote:
>
> Create the 'sysfs' attributes according to configuration provided
> through the capability register, which purpose is to indicate the
> actual number of the components within the particular group.
> Such components could be, for example the FAN or power supply units.
> The motivation is to avoid adding a new code in the future in order to
> distinct between the systems types supported different number of the

supported -> supporting a

> components like power supplies, FANs, ASICs, line cards.

...

>                 /* Go over all units within the item. */
> -               for (j = 0; j < item->count; j++, data++, id++) {
> +               for (j = 0, k = 0; j < item->count; j++, data++) {
> +                       /* Skip if bit in mask is not set. */
> +                       if (!(item->mask & BIT(j)))
> +                               continue;

Instead of splitted comments and this code, perhaps

/* Go over all unmasked units within item */
for_each_set_bit(j, &item->mask, item->count) {
...
}

It might require a mask defined as unsigned long, though. Or temporary
variables.

>                 }
> +               num_attrs += k;
>         }

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2020-07-09 16:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01  9:18 [PATCH platform-next v1 0/8] platform/x86: Add new features for Mellanox systems Vadim Pasternak
2020-06-01  9:18 ` [PATCH platform-next v1 1/8] platform/mellanox: mlxreg-hotplug: Use capability register for attribute creation Vadim Pasternak
2020-07-09 16:06   ` Andy Shevchenko [this message]
2020-06-01  9:18 ` [PATCH platform-next v1 2/8] platform/mellanox: mlxreg-hotplug: Add environmental data to uevent Vadim Pasternak
2020-07-09 16:32   ` Andy Shevchenko
2020-06-01  9:18 ` [PATCH platform-next v1 3/8] platform_data/mlxreg: Add support for complex attributes Vadim Pasternak
2020-06-01  9:18 ` [PATCH platform-next v1 4/8] platform/x86: mlx-platform: Add more definitions for system attributes Vadim Pasternak
2020-06-01  9:18 ` [PATCH platform-next v1 5/8] platform/mellanox: mlxreg-io: Add support for complex attributes Vadim Pasternak
2020-07-09 16:37   ` Andy Shevchenko
2020-06-01  9:18 ` [PATCH platform-next v1 6/8] Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces Vadim Pasternak
2020-06-01  9:18 ` [PATCH platform-next v1 7/8] platform_data/mlxreg: Add presence register field for FAN devices Vadim Pasternak
2020-06-01  9:18 ` [PATCH platform-next v1 8/8] platform/x86: mlx-platform: Extend FAN platform data description Vadim Pasternak

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='CAHp75VfFdf=ZxuURpVR6LRaDm+x4VQsPgR6FLrcZPhLMn8MOpw@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=vadimp@mellanox.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 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).