All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: linux-pwm@vger.kernel.org, Trevor Gamblin <tgamblin@baylibre.com>
Subject: Re: [PATCH v3 5/8] pwm: Add support for pwmchip devices for faster and easier userspace access
Date: Thu, 8 Aug 2024 09:45:13 +0800	[thread overview]
Message-ID: <20240808014513.GA4195@rigel> (raw)
In-Reply-To: <thicnbomf7hux32cx2e5fzd2lpo43hiuaxmxw5tdsppet4hx5j@r2y5cobt4hph>

On Wed, Aug 07, 2024 at 08:04:22AM +0200, Uwe Kleine-König wrote:
> Hello Kent,
>
> On Wed, Aug 07, 2024 at 10:34:33AM +0800, Kent Gibson wrote:
> > On Mon, Jul 29, 2024 at 04:34:21PM +0200, Uwe Kleine-König wrote:
> > > diff --git a/include/uapi/linux/pwm.h b/include/uapi/linux/pwm.h
> > > new file mode 100644
> > > index 000000000000..c89ba3e3def8
> > > --- /dev/null
> > > +++ b/include/uapi/linux/pwm.h
> > > @@ -0,0 +1,25 @@
> > > +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
> > > +
> > > +#ifndef _UAPI_PWM_H_
> > > +#define _UAPI_PWM_H_
> > > +
> > > +#include <linux/ioctl.h>
> > > +#include <linux/types.h>
> > > +
> > > +struct pwmchip_waveform {
> > > +	unsigned int hwpwm;
> > > +	unsigned int __pad; /* padding, must be zero */
> > > +	__u64 period_length_ns;
> > > +	__u64 duty_length_ns;
> > > +	__u64 duty_offset_ns;
> > > +};
> > > +
> >
> > I would go with __u32, rather than unsigned int, to be absolutely clear
> > on sizing.
>
> Hmm, the upside of using unsigned int is that it matches struct
> pwm_device::hwpwm. To the best of my knowledge all Linux platforms have
> sizeof(int) == 4, so a change would have no effect on binary
> representation, but only help the human reader (which is good).
>

The uapi headers define ABI, a machine interface, so I would give
priority to precision over human readibility.
The size of __u32 is guaranteed, while unsigned int is not.

FWIW, __u32 is used more frequently in include/uapi/linux/*.h than unsigned int:

$ grep "unsigned int" include/uapi/linux/*.h | wc -l
441
$ grep __u32 include/uapi/linux/*.h | wc -l
4234

> I don't know yet, but I will consider the suggestion.
>

No problem - just a thought.
Sorry for not reviewing earlier.

Cheers,
Kent.



  reply	other threads:[~2024-08-08  1:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 14:34 [PATCH v3 0/8] pwm: New abstraction and userspace API Uwe Kleine-König
2024-07-29 14:34 ` [PATCH v3 1/8] pwm: Simplify pwm_capture() Uwe Kleine-König
2024-07-29 14:34 ` [PATCH v3 2/8] pwm: Add more locking Uwe Kleine-König
2024-07-29 14:34 ` [PATCH v3 3/8] pwm: New abstraction for PWM waveforms Uwe Kleine-König
2024-07-29 14:34 ` [PATCH v3 4/8] pwm: Provide new consumer API functions for waveforms Uwe Kleine-König
2024-08-20 15:06   ` Trevor Gamblin
2024-09-04 16:46     ` Uwe Kleine-König
2024-07-29 14:34 ` [PATCH v3 5/8] pwm: Add support for pwmchip devices for faster and easier userspace access Uwe Kleine-König
2024-08-07  2:34   ` Kent Gibson
2024-08-07  6:04     ` Uwe Kleine-König
2024-08-08  1:45       ` Kent Gibson [this message]
2024-07-29 14:34 ` [PATCH v3 6/8] pwm: Add tracing for waveform callbacks Uwe Kleine-König
2024-07-30 14:12   ` Steven Rostedt
2024-07-30 15:16     ` Uwe Kleine-König
2024-07-29 14:34 ` [PATCH v3 7/8] pwm: axi-pwmgen: Implementation of the " Uwe Kleine-König
2024-07-29 14:34 ` [PATCH v3 8/8] pwm: stm32: " Uwe Kleine-König
2024-08-20 16:09   ` Fabrice Gasnier
2024-09-04 17:05     ` Uwe Kleine-König
2024-08-06 17:51 ` [PATCH v3 0/8] pwm: New abstraction and userspace API Uwe Kleine-König

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=20240808014513.GA4195@rigel \
    --to=warthog618@gmail.com \
    --cc=linux-pwm@vger.kernel.org \
    --cc=tgamblin@baylibre.com \
    --cc=u.kleine-koenig@baylibre.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.