Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1494264

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

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH v3 1/2] usb: typec: USB Type-C Port Manager (tcpm)
Date 2016-09-30 23:10 +0200
Message-ID <sndea-7hu-11@gated-at.bofh.it> (permalink)
References (1 earlier) <s9rh1-140-55@gated-at.bofh.it> <smZXA-6Lh-9@gated-at.bofh.it> <snbm2-60q-25@gated-at.bofh.it> <snbYJ-6eC-1@gated-at.bofh.it> <snd4t-6Ws-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 2016-09-30 at 13:57 -0700, Guenter Roeck wrote:
> Code now looks as follows.
> 
> #define PDO_VAR_MIN_VOLT(mv) ((((mv) / 50) & PDO_VAR_MIN_VOLT_MASK) << \
>                               PDO_VAR_MIN_VOLT_SHIFT)
> #define PDO_VAR_MAX_VOLT(mv) ((((mv) / 50) & PDO_VAR_MAX_VOLT_MASK) << \
>                               PDO_VAR_MAX_VOLT_SHIFT)
> #define PDO_VAR_MAX_CURR(ma) ((((ma) / 10) & PDO_VAR_MAX_CURR_MASK) << \
>                               PDO_VAR_MAX_CURR_SHIFT)

When #defines are continued, I generally find it nicer to have the
entire definition on a separate line

#define PDO_VAR_MIN_VOLT(mv)						\
	((((mv) / 50) & PDO_VAR_MIN_VOLT_MASK) << PDO_VAR_MIN_VOLT_SHIFT)

> Though maybe I should just ignore line length limits or use shorter defines.

When it makes sense, yes please.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

RE: [RFC PATCH v3 1/2] usb: typec: USB Type-C Port Manager (tcpm) Jun Li <jun.li@nxp.com> - 2016-09-30 09:00 +0200
  Re: [RFC PATCH v3 1/2] usb: typec: USB Type-C Port Manager (tcpm) Guenter Roeck <groeck@google.com> - 2016-09-30 21:10 +0200
    Re: [RFC PATCH v3 1/2] usb: typec: USB Type-C Port Manager (tcpm) Joe Perches <joe@perches.com> - 2016-09-30 21:50 +0200
      Re: [RFC PATCH v3 1/2] usb: typec: USB Type-C Port Manager (tcpm) Guenter Roeck <groeck@google.com> - 2016-09-30 23:00 +0200
        Re: [RFC PATCH v3 1/2] usb: typec: USB Type-C Port Manager (tcpm) Joe Perches <joe@perches.com> - 2016-09-30 23:10 +0200

csiph-web