From: Krzysztof Kozlowski <krzk@kernel.org>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>,
Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] extcon: ptn5150: Use defines for registers
Date: Fri, 11 Sep 2020 09:54:39 +0200 [thread overview]
Message-ID: <20200911075439.GA11145@kozik-lap> (raw)
In-Reply-To: <6e621023-530a-727c-fff7-e8435ca4a4d2@samsung.com>
On Fri, Sep 11, 2020 at 05:03:02PM +0900, Chanwoo Choi wrote:
> On 9/11/20 2:38 PM, Krzysztof Kozlowski wrote:
> > On Fri, Sep 11, 2020 at 12:14:19PM +0900, Chanwoo Choi wrote:
> >> On 9/10/20 12:01 AM, Krzysztof Kozlowski wrote:
> >>> The register addresses are not continuous, so use simple defines for
> >>> them. This also makes it easier to find the address for register.
> >>>
> >>> No functional change.
> >>>
> >>> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> >>> ---
> >>> drivers/extcon/extcon-ptn5150.c | 22 ++++++++++------------
> >>> 1 file changed, 10 insertions(+), 12 deletions(-)
> >>>
> >>> diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c
> >>> index dda5b3a3a908..1b68f56d8372 100644
> >>> --- a/drivers/extcon/extcon-ptn5150.c
> >>> +++ b/drivers/extcon/extcon-ptn5150.c
> >>> @@ -19,18 +19,16 @@
> >>> #include <linux/gpio/consumer.h>
> >>>
> >>> /* PTN5150 registers */
> >>> -enum ptn5150_reg {
> >>> - PTN5150_REG_DEVICE_ID = 0x01,
> >>> - PTN5150_REG_CONTROL,
> >>> - PTN5150_REG_INT_STATUS,
> >>> - PTN5150_REG_CC_STATUS,
> >>> - PTN5150_REG_CON_DET = 0x09,
> >>> - PTN5150_REG_VCONN_STATUS,
> >>> - PTN5150_REG_RESET,
> >>> - PTN5150_REG_INT_MASK = 0x18,
> >>> - PTN5150_REG_INT_REG_STATUS,
> >>> - PTN5150_REG_END,
> >>> -};
> >>> +#define PTN5150_REG_DEVICE_ID 0x01
> >>> +#define PTN5150_REG_CONTROL 0x02
> >>> +#define PTN5150_REG_INT_STATUS 0x03
> >>> +#define PTN5150_REG_CC_STATUS 0x04
> >>> +#define PTN5150_REG_CON_DET 0x09
> >>> +#define PTN5150_REG_VCONN_STATUS 0x0a
> >>> +#define PTN5150_REG_RESET 0x0b
> >>> +#define PTN5150_REG_INT_MASK 0x18
> >>> +#define PTN5150_REG_INT_REG_STATUS 0x19
> >>> +#define PTN5150_REG_END PTN5150_REG_INT_REG_STATUS
> >>
> >> PTN5150_REG_END should be (PTN5150_REG_INT_REG_STATUS + 1)
> >> for regmap operation of PTN5150_REG_INT_REG_STATUS.
> >
> > Why? This goes to regmap's max_register which is the last register
> > allowed to read:
> >
> > drivers/base/regmap/regmap-debugfs.c: for (i = 0; i <= map->max_register; i += map->reg_stride) {
> > drivers/base/regmap/regmap.c: if (map->max_register && reg > map->max_register)
>
> It is my mismake. You're right.
> Applied them. Thanks.
Great, thank you!
Best regards,
Krzysztof
prev parent reply other threads:[~2020-09-11 7:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200909172007epcas1p2fe01380c62ca112a19283f2dc63e75f9@epcas1p2.samsung.com>
2020-09-09 15:01 ` [PATCH 1/2] extcon: ptn5150: Use defines for registers Krzysztof Kozlowski
2020-09-09 15:01 ` [PATCH 2/2] extcon: ptn5150: Do not print error during probe if nothing is attached Krzysztof Kozlowski
2020-09-11 3:14 ` [PATCH 1/2] extcon: ptn5150: Use defines for registers Chanwoo Choi
2020-09-11 5:38 ` Krzysztof Kozlowski
2020-09-11 8:03 ` Chanwoo Choi
2020-09-11 7:54 ` Krzysztof Kozlowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200911075439.GA11145@kozik-lap \
--to=krzk@kernel.org \
--cc=cw00.choi@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=vijaikumar.kanagarajan@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.