mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mary Strodl <mstrodl@csh.rit.edu>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-kernel@vger.kernel.org, tzungbi@kernel.org,
	linus.walleij@linaro.org, brgl@bgdev.pl,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH v3 3/4] gpio: mpsse: add quirk support
Date: Fri, 3 Oct 2025 10:52:42 -0400	[thread overview]
Message-ID: <aN_jOrYnPMWtoR8d@ada.csh.rit.edu> (raw)
In-Reply-To: <aN7hxUz7TGG38Hv_@stanley.mountain>

Hey Dan,

On Thu, Oct 02, 2025 at 11:34:13PM +0300, Dan Carpenter wrote:
> On Thu, Oct 02, 2025 at 02:11:35PM -0400, Mary Strodl wrote:
> > * dir_in/out are bitmask of lines that can go in/out. 0 means
> >   compatible, 1 means incompatible. This is convenient, because it means
> >   if the struct is zeroed out, it supports all pins.
> 
> What?  No, please make 1 be supported and 0 be not supported.  This
> really weirded me out when I read the code.  If it were just 1 for
> true and 0 for false a lot of comments regarding dir_in/out could be
> removed because the code would be straight forward.
> 
> You can easily set everything to 1 by assigning -1 or using memset().
Okay. I was thinking leaving out the fields altogether would be most convenient.

> > +static int mpsse_ensure_supported(struct gpio_chip *chip,
> > +				  unsigned long *mask, int direction)
> 
> Just pass mask not a pointer to mask.  It would be different if
> you were going to allow more than 32 bits to be set, then we would
> need to pass a pointer and use set_bit() etc...
The reason is because of set/get_multiple. I can deref in there instead though.

> > +		dev_err(&priv->udev->dev,
> > +			"mpsse: GPIO %d doesn't support %s\n",
> > +			(int)find_first_bit(&unsupported, sizeof(unsupported) * 8),
> 
> Use %lu instead of %d and get rid of the unnecessary cast.
Good catch. This was a fix for m68k builds that I forgot to remove:
https://lore.kernel.org/linux-gpio/CAMuHMdVpdk5JaqXf6LkSWQvZ7FnfyLdMWOJX+7n0=PZ-udH-WA@mail.gmail.com/

Thanks for taking a look!

  reply	other threads:[~2025-10-03 14:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-02 18:11 [PATCH v3 0/4] gpio: mpsse: add support for bryx brik Mary Strodl
2025-10-02 18:11 ` [PATCH v3 1/4] gpio: mpsse: propagate error from direction_input Mary Strodl
2025-10-02 18:11 ` [PATCH v3 2/4] gpio: mpsse: ensure worker is torn down Mary Strodl
2025-10-02 18:11 ` [PATCH v3 3/4] gpio: mpsse: add quirk support Mary Strodl
2025-10-02 20:34   ` Dan Carpenter
2025-10-03 14:52     ` Mary Strodl [this message]
2025-10-02 18:11 ` [PATCH v3 4/4] gpio: mpsse: support bryx radio interface kit Mary Strodl

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=aN_jOrYnPMWtoR8d@ada.csh.rit.edu \
    --to=mstrodl@csh.rit.edu \
    --cc=brgl@bgdev.pl \
    --cc=dan.carpenter@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tzungbi@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

all inboxes | Powered by JetHome®