Hi Heikki,

> -----Original Message-----
> From: linux-usb-ow...@vger.kernel.org <linux-usb-ow...@vger.kernel.org> On
> Behalf Of Heikki Krogerus
> Sent: Friday, April 12, 2019 8:02 AM
> To: Ajay Gupta <ajayk...@gmail.com>
> Cc: linux-usb@vger.kernel.org; Ajay Gupta <aj...@nvidia.com>
> Subject: Re: [PATCH v6 2/2] usb: typec: ucsi: ccg: add firmware flashing 
> support
> 
> Hi Ajay,
> 
> On Thu, Apr 11, 2019 at 01:03:10PM -0700, Ajay Gupta wrote:
> > +#define CCG_FW_VERSION_NVIDIA(b)   (le16_to_cpu(b) != (('n' << 8) |
> 'v'))
> 
> Does that remove the sparce warning?
Yes. I tested it with steps given at 
https://marc.info/?l=linux-usb&m=155491396220133&w=2 

> Now that I see that this version is specific to NVIDIA,
> I think we are going to
> want to get this detail from a device property. I'll prepare an example for 
> you
> right now so you can see how it can be done.
This version supports NVIDIA specific FW signature which is used to test it. 
See 'n' and 'v' letters in it. Other vendors will have their own signature and 
can just add macros to handle it. 

There is also a comment " Add all supported vendors here " for this in function 
ccg_check_vendor_version()
 
Thanks
> nvpublic
> > +static bool ccg_check_vendor_version(struct ucsi_ccg *uc,
> > +                                struct version_format *app,
> > +                                struct fw_config_table *fw_cfg) {
> > +   struct device *dev = uc->dev;
> > +
> > +   /* Check if the fw build is for supported vendors.
> > +    * Add all supported vendors here.
> > +    */
> > +   if (CCG_FW_VERSION_NVIDIA(app->build)) {
> > +           dev_info(dev, "current fw is not from supported vendor\n");
> > +           return false;
> > +   }
> > +
> > +   /* Check if the new fw build is for supported vendors
> > +    * Add all supported vendors here.
> > +    */
> > +   if (CCG_FW_VERSION_NVIDIA(fw_cfg->app.build)) {
> > +           dev_info(dev, "new fw is not from supported vendor\n");
> > +           return false;
> > +   }
> > +   return true;
> > +}
> 
> Br,
> 
> --
> heikki

Reply via email to