Re: [PATCH v2 2/3] Staging: octeon-usb: Change coding style of CVMX_WAIT_FOR_FIELD32 marco.

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

 



I will change it into function, as i checked so far i will need to
change USB_SET_FIELD32 for the same reason.

On Fri, 27 Jul 2018 at 18:15, Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, Jul 26, 2018 at 06:41:52PM +0300, Georgios Tsotsos wrote:
> > Fixing coding style for CVMX_WAIT_FOR_FIELD32 was confusing. Also
> > encapsulates into parentheses timeout_usec.
> >
> > Signed-off-by: Georgios Tsotsos <tsotsos@xxxxxxxxx>
> > ---
> >  drivers/staging/octeon-usb/octeon-hcd.c | 44 +++++++++++++++++----------------
> >  1 file changed, 23 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
> > index cff5e790b196..c8e0ebf1434f 100644
> > --- a/drivers/staging/octeon-usb/octeon-hcd.c
> > +++ b/drivers/staging/octeon-usb/octeon-hcd.c
> > @@ -378,27 +378,29 @@ struct octeon_hcd {
> >  };
> >
> >  /* This macro spins on a register waiting for it to reach a condition. */
> > -#define CVMX_WAIT_FOR_FIELD32(address, _union, cond, timeout_usec)       \
> > -     ({int result;                                                       \
> > -     do {                                                                \
> > -             u64 done = cvmx_get_cycle() + (u64)timeout_usec *           \
> > -                        octeon_get_clock_rate() / 1000000;               \
> > -             union _union c;                                             \
> > -                                                                         \
> > -             while (1) {                                                 \
> > -                     c.u32 = cvmx_usb_read_csr32(usb, address);          \
> > -                                                                         \
> > -                     if (cond) {                                         \
> > -                             result = 0;                                 \
> > -                             break;                                      \
> > -                     } else if (cvmx_get_cycle() > done) {               \
> > -                             result = -1;                                \
> > -                             break;                                      \
> > -                     } else                                              \
> > -                             __delay(100);                               \
> > -             }                                                           \
> > -     } while (0);                                                        \
> > -     result; })
> > +#define CVMX_WAIT_FOR_FIELD32(address, _union, cond, timeout_usec)   \
> > +({                                                                   \
> > +     int result;                                                     \
> > +     do {                                                            \
> > +             u64 done = cvmx_get_cycle() + (u64)(timeout_usec) *     \
> > +                        octeon_get_clock_rate() / 1000000;           \
> > +             union _union c;                                         \
> > +                                                                     \
> > +             while (1) {                                             \
> > +                     c.u32 = cvmx_usb_read_csr32(usb, address);      \
> > +                                                                     \
> > +                     if (cond) {                                     \
> > +                             result = 0;                             \
> > +                             break;                                  \
> > +                     } else if (cvmx_get_cycle() > done) {           \
> > +                             result = -1;                            \
> > +                             break;                                  \
> > +                     } else                                          \
> > +                             __delay(100);                           \
> > +             }                                                       \
> > +     } while (0);                                                    \
> > +     result;                                                         \
> > +})
>
> It's still a mess, why not just make this a function call instead?
>
> thanks,
>
> greg k-h



-- 
Best regards!
Georgios Tsotsos
Greece-Evia-Chalkida
------------------------------------
Georgios Tsotsos
*Greece - Evia - Chalkida*
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux