Re: [PATCH 1/7] usb: typec: ucsi: add get_fw_info function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 24, 2019 at 05:45:48PM +0000, Ajay Gupta wrote:
> Hi Heikki,
> 
> > > Function is to get the details of ccg firmware and device version.
> > >
> > > Signed-off-by: Ajay Gupta <ajayg@xxxxxxxxxx>
> > > ---
> > >  drivers/usb/typec/ucsi/ucsi_ccg.c | 76
> > > ++++++++++++++++++++++++++++++-
> > >  1 file changed, 74 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c
> > > b/drivers/usb/typec/ucsi/ucsi_ccg.c
> > > index de8a43bdff68..4d35279ab853 100644
> > > --- a/drivers/usb/typec/ucsi/ucsi_ccg.c
> > > +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
> > > @@ -17,15 +17,46 @@
> > >  #include <asm/unaligned.h>
> > >  #include "ucsi.h"
> > >
> > > +struct ccg_dev_info {
> > > +	u8 fw_mode:2;
> > > +	u8 two_pd_ports:2;
> > > +	u8 row_size_256:2;
> > > +	u8:1; /* reserved */
> > > +	u8 hpi_v2_mode:1;
> > > +	u8 bl_mode:1;
> > > +	u8 cfgtbl_invalid:1;
> > > +	u8 fw1_invalid:1;
> > > +	u8 fw2_invalid:1;
> > > +	u8:4; /* reserved */
> > > +	u16 silicon_id;
> > > +	u16 bl_last_row;
> > > +} __packed;
> > > +
> > > +struct version_format {
> > > +	u16 build;
> > > +	u8 patch;
> > > +	u8 min:4;
> > > +	u8 maj:4;
> > > +};
> > 
> > Don't use bit fields. We shouldn't use them even in the core ucsi driver with the
> > message data structures like we do.
> 
> So are you saying to remove bit fields from structure and instead use shift and mask
> on u8 variable to get bit fields?

Yes, exactly.

thanks,

-- 
heikki



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux