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: <2023070402-festive-rind-9274@gregkh>
Date:   Tue, 4 Jul 2023 14:44:33 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Guenter Roeck <linux@...ck-us.net>
Cc:     linux-hwmon@...r.kernel.org, samsagax@...il.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] hwmon: (oxp-sensors): remove static board variable

On Tue, Jul 04, 2023 at 06:39:07AM -0700, Guenter Roeck wrote:
> On 7/4/23 06:17, Greg Kroah-Hartman wrote:
> > Drivers should not have a single static variable for the type of device
> > they are bound to.  While this driver is really going to only have one
> > device at a time in the system, remove the static variable and instead,
> > look up the device type when needed.
> > 
> 
> This is expensive. I think it would be much better to just move
> the board type detection into the init code and not instantiate
> the driver in the fist place if the board type is unknown.

The board type detection is all over the place in the driver, it's not
just for "unknown" types, so how about just saving the board type at
probe time and using it then for all other places?

> We can handle the static variable separately if it really bothers
> you that much.

I did this change to make patch 2/3 more "obvious" what is happening
when the in_visible() callback happens, so that you don't have to worry
about the saved value or not.  But this whole patch isn't really needed
if you don't mind the lookup just happening in the in_visible() callback
for the first time.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ