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]
Message-ID: <ZszhKCKYl9161RIP@surfacebook.localdomain>
Date: Mon, 26 Aug 2024 23:10:16 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Richard Fitzgerald <rf@...nsource.cirrus.com>
Cc: hdegoede@...hat.com, ilpo.jarvinen@...ux.intel.com,
	platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
	patches@...nsource.cirrus.com
Subject: Re: [PATCH v2] platform/x86: serial-multi-instantiate: Don't require
 both I2C and SPI

Wed, Aug 14, 2024 at 02:29:39PM +0100, Richard Fitzgerald kirjoitti:
> Change the Kconfig dependency so that it doesn't require both I2C and SPI
> subsystems to be built. Make a few small changes to the code so that the
> code for a bus is only called if the bus is being built.
> 
> When SPI support was added to serial-multi-instantiate it created a
> dependency that both CONFIG_I2C and CONFIG_SPI must be enabled.
> Typically they are, but there's no reason why this should be a
> requirement. A specific kernel build could have only I2C devices
> or only SPI devices. It should be possible to use serial-multi-instantiate
> if only I2C or only SPI is enabled.
> 
> The dependency formula used is:
> 
>   depends on (I2C && !SPI) || (!I2C && SPI) || (I2C && SPI)
> 
> The advantage of this approach is that if I2C=m or SPI=m then
> SERIAL_MULTI_INSTANTIATE is limited to n/m.

...

>  static void smi_devs_unregister(struct smi *smi)
>  {
> +#if IS_REACHABLE(CONFIG_I2C)

There is no explanation why ugly ifdeffery is used here, while normal
conditionals elsewhere.

>  	while (smi->i2c_num--)
>  		i2c_unregister_device(smi->i2c_devs[smi->i2c_num]);
> +#endif
>  
> -	while (smi->spi_num--)
> -		spi_unregister_device(smi->spi_devs[smi->spi_num]);
> +	if (IS_REACHABLE(CONFIG_SPI)) {
> +		while (smi->spi_num--)
> +			spi_unregister_device(smi->spi_devs[smi->spi_num]);
> +	}
>  }

There are ways to solve this:
1) add a stub for I2C=n for i2c_unregister_device();
2) resplit this driver to have several built modules:
   core, I2C parts, SPI parts.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ