Linux PWM subsystem development
 help / color / mirror / Atom feed
From: Leo Liang <ycliang@andestech.com>
To: <linux-pwm@vger.kernel.org>, <thierry.reding@gmail.com>
Subject: The data type of "period" in struct pwm_state is different from that of "period_ns" in struct pwm_ops
Date: Thu, 20 Jan 2022 11:14:11 +0800	[thread overview]
Message-ID: <20220120031411.GA978903@atcsi01> (raw)

Hi guys,

The data type of "period" member in struct pwm_state is "u64",
but the "period_ns" argument in struct pwm_ops for config operation is "int".

Should a patch be created to have consistent data type in case of an overflow ?
Or that is it the API users' responsibility to do the correct conversion ?

struct pwm_state {
	u64 period;						<<-------------
	u64 duty_cycle;					<<-------------
	enum pwm_polarity polarity;
	bool enabled;
	bool usage_power;
};


struct pwm_ops {
	...
	/* Only used by legacy drivers */
	int (*config)(struct pwm_chip *chip, struct pwm_device *pwm,
		      int duty_ns, int period_ns);							<<---------
	int (*set_polarity)(struct pwm_chip *chip, struct pwm_device *pwm,
			    enum pwm_polarity polarity);
	int (*enable)(struct pwm_chip *chip, struct pwm_device *pwm);
	void (*disable)(struct pwm_chip *chip, struct pwm_device *pwm);
};

Best regards,
Leo

                 reply	other threads:[~2022-01-20  3:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220120031411.GA978903@atcsi01 \
    --to=ycliang@andestech.com \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.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