public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	<alsa-devel@alsa-project.org>, <patches@opensource.cirrus.com>,
	<linux-kernel@vger.kernel.org>,
	Stefan Binding <sbinding@opensource.cirrus.com>
Subject: Re: [PATCH v1 1/4] ALSA: hda/cirrus: Add error handling into CS8409 I2C functions
Date: Mon, 15 Mar 2021 08:45:00 +0100	[thread overview]
Message-ID: <s5htupcrhc3.wl-tiwai@suse.de> (raw)
In-Reply-To: <20210313113410.90088-2-vitalyr@opensource.cirrus.com>

On Sat, 13 Mar 2021 12:34:07 +0100,
Vitaly Rodionov wrote:
> 
> @@ -1508,7 +1508,7 @@ static void cs8409_enable_i2c_clock(struct hda_codec *codec, unsigned int flag)
>  static int cs8409_i2c_wait_complete(struct hda_codec *codec)
>  {
>  	int repeat = 5;
> -	unsigned int retval = 0;
> +	unsigned int retval;
>  
>  	do {
>  		retval = cs_vendor_coef_get(codec, CIR_I2C_STATUS);
> @@ -1520,78 +1520,82 @@ static int cs8409_i2c_wait_complete(struct hda_codec *codec)
>  
>  	} while (repeat);
>  
> -	return repeat > 0 ? 0 : -1;
> +	return !!repeat;
>  }

If the return value of the function has changed, it's nicer to
comment, e.g. a brief function description would be helpful.
Also now this looks rather like a bool?


> @@ -1881,13 +1896,15 @@ static void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res)
>  	reg_hs_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1124, 1);
>  	reg_ts_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1);
>  
> -	/* Clear interrupts */
> +	/* Clear interrupts, by reading interrupt status registers */
>  	cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1b7b, 1);
> -	cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1);
> -	cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1);

Why those two calls are removed?

>  	mutex_unlock(&spec->cs8409_i2c_mux);
>  
> +	/* If status values are < 0, read error has occurred. */
> +	if ((reg_cdc_status < 0) || (reg_hs_status < 0) || (reg_ts_status < 0))
> +		return;

Parentheses around the comparison are superfluous, you can remove
them.


thanks,

Takashi

  reply	other threads:[~2021-03-15  7:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-13 11:34 [PATCH v1 0/4] ALSA: hda/cirrus: Make CS8409 driver more generic by using fixups Vitaly Rodionov
2021-03-13 11:34 ` [PATCH v1 1/4] ALSA: hda/cirrus: Add error handling into CS8409 I2C functions Vitaly Rodionov
2021-03-15  7:45   ` Takashi Iwai [this message]
2021-03-15 15:37     ` Vitaly Rodionov
2021-03-15 15:41       ` Takashi Iwai
2021-03-13 11:34 ` [PATCH v1 2/4] ALSA: hda/cirrus: Cleanup patch_cirrus.c code Vitaly Rodionov
2021-03-13 11:34 ` [PATCH v1 3/4] ALSA: hda/cirrus: Fix CS42L42 Headset Mic volume control name Vitaly Rodionov
2021-03-13 11:34 ` [PATCH v1 4/4] ALSA: hda/cirrus: Make CS8409 driver more generic by using fixups Vitaly Rodionov
2021-03-15  7:49   ` Takashi Iwai
2021-03-15 15:39     ` Vitaly Rodionov
2021-03-14  8:36 ` [PATCH v1 0/4] " Takashi Iwai
2021-03-14 10:18   ` Vitaly Rodionov

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=s5htupcrhc3.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=sbinding@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    --cc=vitalyr@opensource.cirrus.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox