All of lore.kernel.org
 help / color / mirror / Atom feed
* The data type of "period" in struct pwm_state is different from that of "period_ns" in struct pwm_ops
@ 2022-01-20  3:14 Leo Liang
  0 siblings, 0 replies; only message in thread
From: Leo Liang @ 2022-01-20  3:14 UTC (permalink / raw)
  To: linux-pwm, thierry.reding

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-20  3:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-20  3:14 The data type of "period" in struct pwm_state is different from that of "period_ns" in struct pwm_ops Leo Liang

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.