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:   Wed, 22 Sep 2021 16:55:39 +0200
From:   "Sven Peter" <sven@...npeter.dev>
To:     "Heikki Krogerus" <heikki.krogerus@...ux.intel.com>
Cc:     "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
        Guido Günther <agx@...xcpu.org>,
        "Bryan O'Donoghue" <bryan.odonoghue@...aro.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        "Hector Martin" <marcan@...can.st>,
        "Mohamed Mediouni" <mohamed.mediouni@...amail.com>,
        "Stan Skowronek" <stan@...ellium.com>,
        "Mark Kettenis" <mark.kettenis@...all.nl>,
        "Alexander Graf" <graf@...zon.com>,
        "Alyssa Rosenzweig" <alyssa@...enzweig.io>
Subject: Re: [RFT PATCH 2/9] usb: typec: tipd: Prepare supporting different variants

Hi,

Thanks a lot for quick review!

On Tue, Sep 21, 2021, at 15:10, Heikki Krogerus wrote:
> Hi,
>
> On Sat, Sep 18, 2021 at 02:09:27PM +0200, Sven Peter wrote:
>> Apple M1 machines come with a variant of the TI TPS6598x and will need
>> some changes to the current logic. Let's prepare for that by setting up
>> the infrastructure required to support different variants of this chip
>> identified by the DT compatible.
>
> I think in this case it would make sense to just squash this into the
> next patch.

Sure, and taking into account your review for the later patches I will
probably squash most of them into a single commit now.

>
>> Signed-off-by: Sven Peter <sven@...npeter.dev>
>> ---
>>  drivers/usb/typec/tipd/core.c | 19 ++++++++++++++++++-
>>  1 file changed, 18 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
>> index 21b3ae25c76d..656020e7f533 100644
>> --- a/drivers/usb/typec/tipd/core.c
>> +++ b/drivers/usb/typec/tipd/core.c
>> @@ -9,6 +9,7 @@
>>  #include <linux/i2c.h>
>>  #include <linux/acpi.h>
>>  #include <linux/module.h>
>> +#include <linux/of_device.h>
>>  #include <linux/power_supply.h>
>>  #include <linux/regmap.h>
>>  #include <linux/interrupt.h>
>> @@ -76,6 +77,10 @@ static const char *const modes[] = {
>>  /* Unrecognized commands will be replaced with "!CMD" */
>>  #define INVALID_CMD(_cmd_)		(_cmd_ == 0x444d4321)
>>  
>> +struct tps6598x_hw {
>> +};
>
> Black line here.
>
>> +static const struct tps6598x_hw ti_tps6598x_data;
>> +
>>  struct tps6598x {
>>  	struct device *dev;
>>  	struct regmap *regmap;
>> @@ -91,6 +96,8 @@ struct tps6598x {
>>  	struct power_supply *psy;
>>  	struct power_supply_desc psy_desc;
>>  	enum power_supply_usb_type usb_type;
>> +
>> +	const struct tps6598x_hw *hw;
>>  };
>>  
>>  static enum power_supply_property tps6598x_psy_props[] = {
>> @@ -590,6 +597,13 @@ static int tps6598x_probe(struct i2c_client *client)
>>  	if (!tps)
>>  		return -ENOMEM;
>>  
>> +	if (client->dev.of_node)
>> +		tps->hw = of_device_get_match_data(&client->dev);
>> +	else
>> +		tps->hw = &ti_tps6598x_data;
>> +	if (!tps->hw)
>> +		return -EINVAL;
>
> 	tps->hw = of_device_get_match_data(&client->dev);
>         if (!tps->hw)
> 		tps->hw = &ti_tps6598x_data;
>

Ah yes, that's indeed much nicer!

>>  	mutex_init(&tps->lock);
>>  	tps->dev = &client->dev;
>>  
>> @@ -729,8 +743,11 @@ static int tps6598x_remove(struct i2c_client *client)
>>  	return 0;
>>  }
>>  
>> +static const struct tps6598x_hw ti_tps6598x_data = {
>> +};
>
> You could also move that above tps6598x_probe() and get rid of the
> forward declaration.

Ack.



Best,

Sven

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ