lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <90D59877-4FED-483D-8581-85E017614A57@protonmail.com>
Date:   Thu, 08 Sep 2022 16:03:03 +0000
From:   Martin PoviĊĦer <povik@...tonmail.com>
To:     Richard Fitzgerald <rf@...nsource.cirrus.com>
Cc:     Mark Brown <broonie@...nel.org>, patches@...nsource.cirrus.com,
        alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 09/12] ASoC: cs42l42: Split I2C identity into separate module


> On 19. 8. 2022, at 14:52, Richard Fitzgerald <rf@...nsource.cirrus.com> wrote:
>
> Split the I2C bus driver definition and probe()/remove() into a
> separate module so that a Soundwire build of CS42L42 support does
> not have a spurious dependency on I2C.
>
> Signed-off-by: Richard Fitzgerald <rf@...nsource.cirrus.com>
> ---


> +static int cs42l42_i2c_probe(struct i2c_client *i2c_client)
> +{
> +	struct device *dev = &i2c_client->dev;
> +	struct cs42l42_private *cs42l42;
> +	struct regmap *regmap;
> +	int ret;
> +
> +	cs42l42 = devm_kzalloc(dev, sizeof(*cs42l42), GFP_KERNEL);
> +	if (!cs42l42)
> +		return -ENOMEM;
> +
> +	regmap = devm_regmap_init_i2c(i2c_client, &cs42l42_regmap);
> +	if (IS_ERR(regmap)) {
> +		ret = PTR_ERR(regmap);
> +		dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	cs42l42->dev = dev;
> +	cs42l42->regmap = regmap;
> +	cs42l42->irq = i2c_client->irq;
> +
> +	ret = cs42l42_common_probe(cs42l42, &cs42l42_soc_component, &cs42l42_dai);
> +	if (ret)
> +		return ret;
> +
> +	return cs42l42_init(cs42l42);

The common_remove should probably be called here if the init fails.

Best,
Martin

> +}
> +
> +static int cs42l42_i2c_remove(struct i2c_client *i2c_client)
> +{
> +	struct cs42l42_private *cs42l42 = dev_get_drvdata(&i2c_client->dev);
> +
> +	cs42l42_common_remove(cs42l42);
> +
> +	return 0;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ