Re: [PATCH v2 1/6] media: adv748x: Add is_txb()

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

 



Hi Jacopo,

On 07/01/2019 10:05, Jacopo Mondi wrote:
> Hi Kieran,

<snip>

>>> diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h
>>> index b482c7fe6957..bc2da1b5ce29 100644
>>> --- a/drivers/media/i2c/adv748x/adv748x.h
>>> +++ b/drivers/media/i2c/adv748x/adv748x.h
>>> @@ -89,8 +89,12 @@ struct adv748x_csi2 {
>>>
>>>  #define notifier_to_csi2(n) container_of(n, struct adv748x_csi2, notifier)
>>>  #define adv748x_sd_to_csi2(sd) container_of(sd, struct adv748x_csi2, sd)
>>> +
>>>  #define is_tx_enabled(_tx) ((_tx)->state->endpoints[(_tx)->port] != NULL)
>>> -#define is_txa(_tx) ((_tx) == &(_tx)->state->txa)
>>> +#define __is_tx(_tx, _ab) ((_tx) == &(_tx)->state->tx##_ab)
>>> +#define is_txa(_tx) __is_tx(_tx, a)
>>> +#define is_txb(_tx) __is_tx(_tx, b)
>>
>> I would have just duplicated the is_txa() line here... but this is good
>> too :)
> 
> I agree it might seem more complex than necessary. I initially made it
> like this as I started from the 'is_tx()' macro this series adds in
> 6/6.
> 
> If it is easier to have an '((_tx) == &(_tx)->state->txb)' I can
> change this.

It's fine for me as you've got it.

It's still clear and readable, and implements the required functionality.

<snip>

-- 
Regards
--
Kieran



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux