lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 1 Feb 2024 13:26:53 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Raag Jadav <raag.jadav@...el.com>
Cc: u.kleine-koenig@...gutronix.de, jarkko.nikula@...ux.intel.com,
	mika.westerberg@...ux.intel.com, lakshmi.sowjanya.d@...el.com,
	linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/3] pwm: dwc: Add 16 channel support for Intel
 Elkhart Lake

On Tue, Jan 30, 2024 at 12:30:23PM +0200, Raag Jadav wrote:
> On Sun, Jan 28, 2024 at 04:53:24PM +0200, Andy Shevchenko wrote:
> > On Mon, Jan 22, 2024 at 08:32:36AM +0530, Raag Jadav wrote:
> > > Intel Elkhart Lake PSE includes two instances of PWM as a single PCI
> > > function with 8 channels each. Add support for the remaining channels.

..

> > First option: Always provide driver data (info is never NULL).
> 
> Allowing empty driver_data would save us from adding dummy info
> for single instance devices in the future.

Which may be too premature "optimisation". Why? Because if we ever have
something like pci_dev_get_match_data(), the empty will mean NULL, and
we may not get difference between empty and missing one.

> > Second option, have the body of the for-loop be factored to a helper
> > dwc_pwm_init_one() and here
> > 
> > 	if (!info)
> > 		return dwc_pwm_init_one(..., 1, 0);
> > 
> > 	for (i = 0; i < info->nr; i++) {
> > 		ret = dwc_pwm_init_one(...);
> > 		if (ret)
> > 			return ret;
> > 	}
> 
> Considering above, we're looking at something like this.

As one option, yes.

> static int dwc_pwm_init_one(struct device *dev, void __iomem *base, unsigned int size)
> {
>         struct dwc_pwm *dwc;
> 
>         dwc = dwc_pwm_alloc(dev);
>         if (!dwc)
>                 return -ENOMEM;
> 
>         dwc->base = base + size;
> 
>         return devm_pwmchip_add(dev, &dwc->chip);
> }

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ