All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Mia Lin <mimi05633@gmail.com>
Cc: avifishman70@gmail.com, tmaimon77@gmail.com,
	tali.perry1@gmail.com, venture@google.com, yuenn@google.com,
	benjaminfair@google.com, a.zummo@towertech.it, KWLIU@nuvoton.com,
	JJLIU0@nuvoton.com, KFLIN@nuvoton.com, mylin1@nuvoton.com,
	openbmc@lists.ozlabs.org, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/1] rtc: nuvoton: Compatible with NCT3015Y-R and NCT3018Y-R
Date: Thu, 24 Aug 2023 00:12:43 +0200	[thread overview]
Message-ID: <2023082322124382cfd168@mail.local> (raw)
In-Reply-To: <20230816012540.18464-2-mimi05633@gmail.com>

Hello,

On 16/08/2023 09:25:40+0800, Mia Lin wrote:
> -	dev_dbg(&client->dev, "%s:alarm_enable:%x alarm_flag:%x\n",
> -		__func__, *alarm_enable, *alarm_flag);
> +	if (alarm_enable && alarm_flag)

I don't really see the point of conditionally displaying this debug
message.

> +		dev_dbg(&client->dev, "%s: alarm_enable=%x, alarm_flag=%x.\n",
> +			__func__, *alarm_enable, *alarm_flag);
>  
>  	return 0;
>  }
> @@ -123,17 +124,17 @@ static irqreturn_t nct3018y_irq(int irq, void *dev_id)
>  	unsigned char alarm_flag;
>  	unsigned char alarm_enable;
>  
> -	dev_dbg(&client->dev, "%s:irq:%d\n", __func__, irq);
> +	dev_dbg(&client->dev, "%s: irq=%d.\n", __func__, irq);

You have many of those changes where you only add a space, I feel like
this is a matter of taste and this makes it more difficult than
necessary to read your patch.

>  	err = nct3018y_get_alarm_mode(nct3018y->client, &alarm_enable, &alarm_flag);
>  	if (err)
>  		return IRQ_NONE;
>  
>  	if (alarm_flag) {
> -		dev_dbg(&client->dev, "%s:alarm flag:%x\n",
> +		dev_dbg(&client->dev, "%s: alarm flag=%x.\n",
>  			__func__, alarm_flag);
>  		rtc_update_irq(nct3018y->rtc, 1, RTC_IRQF | RTC_AF);
>  		nct3018y_set_alarm_mode(nct3018y->client, 0);
> -		dev_dbg(&client->dev, "%s:IRQ_HANDLED\n", __func__);
> +		dev_dbg(&client->dev, "%s: IRQ_HANDLED.\n", __func__);
>  		return IRQ_HANDLED;
>  	}
>  
> @@ -155,7 +156,7 @@ static int nct3018y_rtc_read_time(struct device *dev, struct rtc_time *tm)
>  		return err;
>  
>  	if (!buf[0]) {
> -		dev_dbg(&client->dev, " voltage <=1.7, date/time is not reliable.\n");
> +		dev_dbg(&client->dev, "%s: voltage <=1.7, date/time is not reliable.\n", __func__);
>  		return -EINVAL;
>  	}
>  
> @@ -178,26 +179,50 @@ static int nct3018y_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	unsigned char buf[4] = {0};
> -	int err;
> +	int err, part_num, flags;
> +	int restore_flags = 0;
> +
> +	part_num = i2c_smbus_read_byte_data(client, NCT3018Y_REG_PART);

Do you really have to check the part number every time you set the time?
I don't expect it to change once read in probe.

> +	if (part_num < 0) {
> +		dev_dbg(&client->dev, "%s: Failed to read part info reg.\n", __func__);
> +		return part_num;
> +	}
> +

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Mia Lin <mimi05633@gmail.com>
Cc: linux-rtc@vger.kernel.org, a.zummo@towertech.it,
	mylin1@nuvoton.com, benjaminfair@google.com, KWLIU@nuvoton.com,
	avifishman70@gmail.com, venture@google.com,
	openbmc@lists.ozlabs.org, JJLIU0@nuvoton.com,
	linux-kernel@vger.kernel.org, tali.perry1@gmail.com,
	KFLIN@nuvoton.com, tmaimon77@gmail.com
Subject: Re: [PATCH v4 1/1] rtc: nuvoton: Compatible with NCT3015Y-R and NCT3018Y-R
Date: Thu, 24 Aug 2023 00:12:43 +0200	[thread overview]
Message-ID: <2023082322124382cfd168@mail.local> (raw)
In-Reply-To: <20230816012540.18464-2-mimi05633@gmail.com>

Hello,

On 16/08/2023 09:25:40+0800, Mia Lin wrote:
> -	dev_dbg(&client->dev, "%s:alarm_enable:%x alarm_flag:%x\n",
> -		__func__, *alarm_enable, *alarm_flag);
> +	if (alarm_enable && alarm_flag)

I don't really see the point of conditionally displaying this debug
message.

> +		dev_dbg(&client->dev, "%s: alarm_enable=%x, alarm_flag=%x.\n",
> +			__func__, *alarm_enable, *alarm_flag);
>  
>  	return 0;
>  }
> @@ -123,17 +124,17 @@ static irqreturn_t nct3018y_irq(int irq, void *dev_id)
>  	unsigned char alarm_flag;
>  	unsigned char alarm_enable;
>  
> -	dev_dbg(&client->dev, "%s:irq:%d\n", __func__, irq);
> +	dev_dbg(&client->dev, "%s: irq=%d.\n", __func__, irq);

You have many of those changes where you only add a space, I feel like
this is a matter of taste and this makes it more difficult than
necessary to read your patch.

>  	err = nct3018y_get_alarm_mode(nct3018y->client, &alarm_enable, &alarm_flag);
>  	if (err)
>  		return IRQ_NONE;
>  
>  	if (alarm_flag) {
> -		dev_dbg(&client->dev, "%s:alarm flag:%x\n",
> +		dev_dbg(&client->dev, "%s: alarm flag=%x.\n",
>  			__func__, alarm_flag);
>  		rtc_update_irq(nct3018y->rtc, 1, RTC_IRQF | RTC_AF);
>  		nct3018y_set_alarm_mode(nct3018y->client, 0);
> -		dev_dbg(&client->dev, "%s:IRQ_HANDLED\n", __func__);
> +		dev_dbg(&client->dev, "%s: IRQ_HANDLED.\n", __func__);
>  		return IRQ_HANDLED;
>  	}
>  
> @@ -155,7 +156,7 @@ static int nct3018y_rtc_read_time(struct device *dev, struct rtc_time *tm)
>  		return err;
>  
>  	if (!buf[0]) {
> -		dev_dbg(&client->dev, " voltage <=1.7, date/time is not reliable.\n");
> +		dev_dbg(&client->dev, "%s: voltage <=1.7, date/time is not reliable.\n", __func__);
>  		return -EINVAL;
>  	}
>  
> @@ -178,26 +179,50 @@ static int nct3018y_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  	unsigned char buf[4] = {0};
> -	int err;
> +	int err, part_num, flags;
> +	int restore_flags = 0;
> +
> +	part_num = i2c_smbus_read_byte_data(client, NCT3018Y_REG_PART);

Do you really have to check the part number every time you set the time?
I don't expect it to change once read in probe.

> +	if (part_num < 0) {
> +		dev_dbg(&client->dev, "%s: Failed to read part info reg.\n", __func__);
> +		return part_num;
> +	}
> +

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2023-08-23 22:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16  1:25 [PATCH v4 0/1] Compatible with NCT3015Y-R and NCT3018Y-R Mia Lin
2023-08-16  1:25 ` Mia Lin
2023-08-16  1:25 ` [PATCH v4 1/1] rtc: nuvoton: " Mia Lin
2023-08-16  1:25   ` Mia Lin
2023-08-23 22:12   ` Alexandre Belloni [this message]
2023-08-23 22:12     ` Alexandre Belloni
2023-08-29 13:35     ` Minying Lin
2023-08-29 14:22       ` Alexandre Belloni
2023-08-29 14:22         ` Alexandre Belloni
2023-08-31  0:57         ` Mining Lin

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=2023082322124382cfd168@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=JJLIU0@nuvoton.com \
    --cc=KFLIN@nuvoton.com \
    --cc=KWLIU@nuvoton.com \
    --cc=a.zummo@towertech.it \
    --cc=avifishman70@gmail.com \
    --cc=benjaminfair@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mimi05633@gmail.com \
    --cc=mylin1@nuvoton.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=tali.perry1@gmail.com \
    --cc=tmaimon77@gmail.com \
    --cc=venture@google.com \
    --cc=yuenn@google.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.