public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@kernel.org>
To: Hans Hu <hanshu-oc@zhaoxin.com>
Cc: krzk@kernel.org, linux-i2c@vger.kernel.org, cobechen@zhaoxin.com,
	TonyWWang@zhaoxin.com
Subject: Re: [PATCH v4] i2c: add support for Zhaoxin I2C controller
Date: Fri, 9 Jun 2023 14:47:20 +0200	[thread overview]
Message-ID: <20230609124720.lir2brhmlpiekrvs@intel.intel> (raw)
In-Reply-To: <20230609031625.6928-1-hanshu-oc@zhaoxin.com>

One more thing,

> +static irqreturn_t zxi2c_irq_handle(int irq, void *dev_id)
> +{
> +	struct zxi2c *i2c = (struct zxi2c *)dev_id;
> +	void __iomem *regs = i2c->regs;
> +	u8 status = zxi2c_get_irq_status(regs);
> +
> +	if ((status & ZXI2C_STS_MASK) == 0)
> +		return IRQ_NONE;
> +
> +	if (status & ZXI2C_SCL_TIMEOUT)
> +		dev_warn(i2c->dev, "timeout(HW), ID: 0x%X\n", i2c->addr);
> +
> +	if (status & ZXI2C_STS_ADDRNACK) {
> +		dev_dbg(i2c->dev, "addr NACK, ID: 0x%X\n", i2c->addr);
> +	} else if (status & ZXI2C_STS_BYTEEND) {
> +		i2c->byte_left--;
> +		if (!i2c->is_read) {
> +			if (zxi2c_is_nack(regs)) {
> +				status = ZXI2C_STS_BYTENACK;
> +				i2c->byte_left++;
> +				dev_err(i2c->dev, "data NACK, ID: 0x%X\n",
> +					i2c->addr);

form these dev_warn, dev_dbg, dev_err in an irq context, what
worries me is that if something goes wrong you would flood the
dmesg with error/warning/debug messages.

How about using

	dev_err_ratelimited()
	dev_warn_ratelimited()
	dev_dbg_ratelimited()

?

Andi

> +			} else if (i2c->byte_left == 0 && i2c->is_last_msg) {
> +				zxi2c_stop_wr(regs);
> +			}
> +		}
> +	}
> +
> +	i2c->event = status;
> +	zxi2c_clear_status(regs);
> +	wake_up(&i2c->waitq);
> +
> +	return IRQ_HANDLED;
> +}

  parent reply	other threads:[~2023-06-09 12:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09  3:16 [PATCH v4] i2c: add support for Zhaoxin I2C controller Hans Hu
2023-06-09  9:33 ` Krzysztof Kozlowski
2023-06-12  3:31   ` Hans Hu
2023-06-09 12:24 ` Andi Shyti
2023-06-09 13:11   ` Krzysztof Kozlowski
2023-06-12  8:24   ` Hans Hu
2023-06-09 12:47 ` Andi Shyti [this message]
2023-06-14  7:34 ` [PATCH v5] " Hans Hu
2023-06-14  8:21   ` Andi Shyti
2023-06-14  9:48   ` [PATCH v6] " Hans Hu
2023-06-23  8:47     ` Wolfram Sang
2023-06-25 10:57       ` Hans Hu
2023-06-30  8:01         ` Andi Shyti
     [not found]           ` <6f3479fb79944d5a8b4a562d67c82a4b@zhaoxin.com>
     [not found]             ` <1abb34e5cbe74514911598a5a522045b@zhaoxin.com>
2023-07-06  7:25               ` Hans Hu
  -- strict thread matches above, loose matches on Subject: below --
2023-06-09  2:55 [PATCH v4] " Hans Hu

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=20230609124720.lir2brhmlpiekrvs@intel.intel \
    --to=andi.shyti@kernel.org \
    --cc=TonyWWang@zhaoxin.com \
    --cc=cobechen@zhaoxin.com \
    --cc=hanshu-oc@zhaoxin.com \
    --cc=krzk@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox