Re: [RFC PATCH v3 1/2] usb: typec: USB Type-C Port Manager (tcpm)

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

 



On Fri, 2016-09-30 at 12:06 -0700, Guenter Roeck wrote:
> On Thu, Sep 29, 2016 at 11:37 PM, Jun Li <jun.li@xxxxxxx> wrote:
[]
> > diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h
[]
> > +#define PDO_VAR(min_mv, max_mv, max_ma)                                      \
> > +     ((PDO_TYPE_VAR << PDO_TYPE_SHIFT) |                             \
> > +      ((((min_mv) / 50) & PDO_VAR_MIN_VOLT_MASK) <<                  \
> > +       PDO_VAR_MIN_VOLT_SHIFT) |                                     \
> > +      ((((max_mv) / 50) & PDO_VAR_MAX_VOLT_MASK) <<                  \
> > +       PDO_VAR_MAX_VOLT_SHIFT) |                                     \
> > +      ((((max_ma) / 50) & PDO_VAR_MAX_CURR_MASK) <<                  \
> 
> 
> ((((max_ma) / 10) & PDO_VAR_MAX_CURR_MASK) <<                  \

This would be easier to read if laid out differently.

#define PDO_VAR(min_mv, max_mv, max_ma)							\
	((PDO_TYPE_VAR << PDO_TYPE_SHIFT) |						\
	 ((((min_mv) / 50) & PDO_VAR_MIN_VOLT_MASK) << PDO_VAR_MIN_VOLT_SHIFT) |	\
	 ((((max_mv) / 50) & PDO_VAR_MAX_VOLT_MASK) << PDO_VAR_MAX_VOLT_SHIFT) |	\
	 ((((max_ma) / 10) & PDO_VAR_MAX_CURR_MASK) << PDO_VAR_MAX_CURR_SHIFT))

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

  Powered by Linux