Re: [RFC PATCH v2 08/10] rtc: bd70528: Initial support for ROHM bd70528 RTC

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

 



On Sat, Jan 26, 2019 at 08:30:24AM -0800, Guenter Roeck wrote:
> On 1/25/19 3:05 AM, Matti Vaittinen wrote:



> > +static int bd70528_set_wake(struct bd70528 *bd70528,
> > +			    int enable, int *old_state)
> > +{
> > +	int ret;
> > +	unsigned int ctrl_reg;
> > +
> > +	ret = regmap_read(bd70528->chip.regmap, BD70528_REG_WAKE_EN, &ctrl_reg);
> > +	if (ret)
> > +		return ret;
> > +
> > +	if (old_state) {
> > +		if (ctrl_reg & BD70528_MASK_WAKE_EN)
> > +			*old_state |= BD70528_WAKE_STATE_BIT;
> > +		else
> > +			*old_state &= ~BD70528_WAKE_STATE_BIT;
> > +
> > +		if ((!enable) == (!(*old_state & BD70528_WAKE_STATE_BIT)))
> > +			return 0;
> 
> I think
> 		if (enable == !!(*old_state & BD70528_WAKE_STATE_BIT))
> would be much better readable. Even if not, there are way too many ()
> in the above conditional.
> 

The substitution is not equivalent to original.  I think you mean:

 		if (!!enable == !!(*old_state & BD70528_WAKE_STATE_BIT))



-- 

-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux