From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Javier Carrasco <javier.carrasco.cruz@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
Jonathan Corbet <corbet@lwn.net>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v2 3/4] hwmon: Add support for Amphenol ChipCap 2
Date: Thu, 9 Nov 2023 09:52:49 +0100 [thread overview]
Message-ID: <30ccb0a9-c0bd-491e-817f-def0aeda11c6@linaro.org> (raw)
In-Reply-To: <20231020-topic-chipcap2-v2-3-f5c325966fdb@gmail.com>
On 08/11/2023 16:37, Javier Carrasco wrote:
> The Amphenol ChipCap 2 is a capacitive polymer humidity and temperature
> sensor with an integrated EEPROM and minimum/maximum humidity alarms.
>
> All device variants offer an I2C interface and depending on the part
> number, two different output modes:
> - CC2D: digital output
> - CC2A: analog (PDM) output
>
> This driver adds support for the digital variant (CC2D part numbers),
> which is also divided into two subfamilies [1]:
> - CC2DXX: non-sleep measurement mode
> - CC2DXXS: sleep measurement mode
...
> +
> +static int cc2_probe(struct i2c_client *client)
> +{
> + struct cc2_data *data;
> + struct device *dev = &client->dev;
> + enum cc2_ids chip;
> + int ret;
> +
> + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
> + return -EOPNOTSUPP;
> +
> + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> + if (!data)
> + return -ENOMEM;
> +
> + i2c_set_clientdata(client, data);
> +
> + mutex_init(&data->i2c_lock);
> + mutex_init(&data->alarm_lock);
> +
> + data->client = client;
> +
> + if (client->dev.of_node)
> + chip = (uintptr_t)of_device_get_match_data(&client->dev);
> + else
> + chip = i2c_match_id(cc2_id, client)->driver_data;
> +
> + data->config = &cc2_config[chip];
> +
> + ret = cc2_request_ready_irq(data, dev);
> + if (ret)
> + return ret;
> +
> + data->regulator = devm_regulator_get_optional(dev, "vdd");
> + if (!IS_ERR(data->regulator)) {
> + ret = cc2_retrive_alarm_config(data);
> + if (ret)
> + goto cleanup;
> + } else {
> + /* No access to EEPROM without regulator: no alarm control */
> + goto dev_register;
Nothing improved here.
Do not send new version of patchset before discussion finishes.
> + }
> +
> + ret = cc2_request_alarm_irqs(data, dev);
> + if (ret)
> + goto cleanup;
> +
> +dev_register:
> + data->hwmon = devm_hwmon_device_register_with_info(dev, client->name,
> + data, &cc2_chip_info,
> + NULL);
> + if (IS_ERR(data->hwmon)) {
> + ret = PTR_ERR(data->hwmon);
> + goto cleanup;
> + }
> +
> + return 0;
> +
> +cleanup:
> + if (cc2_disable(data))
> + dev_dbg(dev, "Failed to disable device");
> +
> + return dev_err_probe(dev, ret,
> + "Unable to register hwmon device\n");
Drop or move to each error path.
Best regards,
Krzysztof
next prev parent reply other threads:[~2023-11-09 8:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-08 15:37 [PATCH v2 0/4] hwmon: Add support for Amphenol ChipCap 2 Javier Carrasco
2023-11-08 15:37 ` [PATCH v2 1/4] dt-bindings: vendor-prefixes: add Amphenol Javier Carrasco
2023-11-09 8:53 ` Krzysztof Kozlowski
2023-11-08 15:37 ` [PATCH v2 2/4] hwmon: (core) Add support for humidity min/max alarm Javier Carrasco
2023-11-09 0:02 ` Guenter Roeck
2023-11-09 6:24 ` Javier Carrasco
2023-11-15 13:25 ` Guenter Roeck
2023-11-15 13:56 ` Javier Carrasco
2023-11-08 15:37 ` [PATCH v2 3/4] hwmon: Add support for Amphenol ChipCap 2 Javier Carrasco
2023-11-09 8:52 ` Krzysztof Kozlowski [this message]
2023-11-09 14:55 ` Guenter Roeck
2023-11-09 15:36 ` Javier Carrasco
2023-11-09 16:18 ` Krzysztof Kozlowski
2023-11-09 16:25 ` Guenter Roeck
2023-11-08 15:37 ` [PATCH v2 4/4] dt-bindings: hwmon: Add " Javier Carrasco
2023-11-09 8:53 ` Krzysztof Kozlowski
2023-11-09 9:02 ` Javier Carrasco
2023-11-09 9:20 ` Krzysztof Kozlowski
2023-11-09 9:25 ` Javier Carrasco
2023-11-09 17:28 ` Conor Dooley
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=30ccb0a9-c0bd-491e-817f-def0aeda11c6@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jdelvare@suse.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh+dt@kernel.org \
--cc=robh@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;
as well as URLs for NNTP newsgroup(s).