On Wed, Feb 12, 2020 at 01:51:15PM -0500, Marcelo Diop-Gonzalez wrote:
> On Wed, Feb 12, 2020 at 1:43 PM Marcelo Diop-Gonzalez
> <marcgonza...@google.com> wrote:
> >
> > there are extra parentheses around many conditional statements
> > that make things a little harder to read
> >
> > Signed-off-by: Marcelo Diop-Gonzalez <marcgonza...@google.com>
> > ---
> >  .../interface/vchiq_arm/vchiq_core.c          | 36 +++++++++----------
> >  1 file changed, 18 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
> > b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> > index 4f8b59deaec9..72bfa0f73958 100644
> > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> > @@ -138,8 +138,8 @@ find_service_by_handle(unsigned int handle)
> >
> >         spin_lock(&service_spinlock);
> >         service = handle_to_service(handle);
> > -       if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE) &&
> > -               (service->handle == handle)) {
> > +       if (service && service->srvstate != VCHIQ_SRVSTATE_FREE &&
> > +           service->handle == handle) {
> >                 WARN_ON(service->ref_count == 0);
> >                 service->ref_count++;
> >         } else
> > @@ -161,7 +161,7 @@ find_service_by_port(struct vchiq_state *state, int 
> > localport)
> >         if ((unsigned int)localport <= VCHIQ_PORT_MAX) {
> >                 spin_lock(&service_spinlock);
> >                 service = state->services[localport];
> > -               if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE)) {
> > +               if (service && service->srvstate != VCHIQ_SRVSTATE_FREE) {
> >                         WARN_ON(service->ref_count == 0);
> >                         service->ref_count++;
> >                 } else
> > @@ -184,9 +184,9 @@ find_service_for_instance(struct vchiq_instance 
> > *instance,
> >
> >         spin_lock(&service_spinlock);
> >         service = handle_to_service(handle);
> > -       if (service && (service->srvstate != VCHIQ_SRVSTATE_FREE) &&
> > -               (service->handle == handle) &&
> > -               (service->instance == instance)) {
> > +       if (service && service->srvstate != VCHIQ_SRVSTATE_FREE &&
> > +           service->handle == handle &&
> > +           service->instance == instance) {
> >                 WARN_ON(service->ref_count == 0);
> >                 service->ref_count++;
> >         } else
> > @@ -209,10 +209,10 @@ find_closed_service_for_instance(struct 
> > vchiq_instance *instance,
> >         spin_lock(&service_spinlock);
> >         service = handle_to_service(handle);
> >         if (service &&
> > -               ((service->srvstate == VCHIQ_SRVSTATE_FREE) ||
> > -                (service->srvstate == VCHIQ_SRVSTATE_CLOSED)) &&
> > -               (service->handle == handle) &&
> > -               (service->instance == instance)) {
> > +           (service->srvstate == VCHIQ_SRVSTATE_FREE ||
> > +            service->srvstate == VCHIQ_SRVSTATE_CLOSED) &&
> > +           service->handle == handle &&
> > +           service->instance == instance) {
> >                 WARN_ON(service->ref_count == 0);
> >                 service->ref_count++;
> >         } else
> > @@ -237,8 +237,8 @@ next_service_by_instance(struct vchiq_state *state, 
> > struct vchiq_instance *insta
> >         while (idx < state->unused_service) {
> >                 struct vchiq_service *srv = state->services[idx++];
> >
> > -               if (srv && (srv->srvstate != VCHIQ_SRVSTATE_FREE) &&
> > -                       (srv->instance == instance)) {
> > +               if (srv && srv->srvstate != VCHIQ_SRVSTATE_FREE &&
> > +                   srv->instance == instance) {
> >                         service = srv;
> >                         WARN_ON(service->ref_count == 0);
> >                         service->ref_count++;
> > @@ -464,10 +464,10 @@ get_listening_service(struct vchiq_state *state, int 
> > fourcc)
> >                 struct vchiq_service *service = state->services[i];
> >
> >                 if (service &&
> > -                       (service->public_fourcc == fourcc) &&
> > -                       ((service->srvstate == VCHIQ_SRVSTATE_LISTENING) ||
> > -                       ((service->srvstate == VCHIQ_SRVSTATE_OPEN) &&
> > -                       (service->remoteport == VCHIQ_PORT_FREE)))) {
> > +                   service->public_fourcc == fourcc &&
> > +                   (service->srvstate == VCHIQ_SRVSTATE_LISTENING ||
> > +                    (service->srvstate == VCHIQ_SRVSTATE_OPEN &&
> > +                     service->remoteport == VCHIQ_PORT_FREE))) {
> >                         lock_service(service);
> >                         return service;
> >                 }
> > @@ -485,8 +485,8 @@ get_connected_service(struct vchiq_state *state, 
> > unsigned int port)
> >         for (i = 0; i < state->unused_service; i++) {
> >                 struct vchiq_service *service = state->services[i];
> >
> > -               if (service && (service->srvstate == VCHIQ_SRVSTATE_OPEN)
> > -                       && (service->remoteport == port)) {
> > +               if (service && service->srvstate == VCHIQ_SRVSTATE_OPEN &&
> > +                   service->remoteport == port) {
> >                         lock_service(service);
> >                         return service;
> >                 }
> > --
> > 2.25.0.225.g125e21ebc7-goog
> >
> 
> I have to admit that this one trades one checkpatch warning for
> another.... (line too long). It seemed like it looks better this way,
> and getting rid of the long lines would have meant refactoring more
> stuff, but if its a problem I can redo this one

No worries, I'll take it :)
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to