chipcap2.c (a23e1966932464e1c5226cb9ac4ce1d5fc10ba22) chipcap2.c (f775f6d17035408be4a4b30c55d812fb7e6aab57)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * cc2.c - Support for the Amphenol ChipCap 2 relative humidity, temperature sensor
4 *
5 * Part numbers supported:
6 * CC2D23, CC2D23S, CC2D25, CC2D25S, CC2D33, CC2D33S, CC2D35, CC2D35S
7 *
8 * Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>

--- 726 unchanged lines hidden (view full) ---

735
736 i2c_set_clientdata(client, data);
737
738 mutex_init(&data->dev_access_lock);
739
740 data->client = client;
741
742 data->regulator = devm_regulator_get_exclusive(dev, "vdd");
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * cc2.c - Support for the Amphenol ChipCap 2 relative humidity, temperature sensor
4 *
5 * Part numbers supported:
6 * CC2D23, CC2D23S, CC2D25, CC2D25S, CC2D33, CC2D33S, CC2D35, CC2D35S
7 *
8 * Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>

--- 726 unchanged lines hidden (view full) ---

735
736 i2c_set_clientdata(client, data);
737
738 mutex_init(&data->dev_access_lock);
739
740 data->client = client;
741
742 data->regulator = devm_regulator_get_exclusive(dev, "vdd");
743 if (IS_ERR(data->regulator)) {
744 dev_err_probe(dev, PTR_ERR(data->regulator),
745 "Failed to get regulator\n");
746 return PTR_ERR(data->regulator);
747 }
743 if (IS_ERR(data->regulator))
744 return dev_err_probe(dev, PTR_ERR(data->regulator),
745 "Failed to get regulator\n");
748
749 ret = cc2_request_ready_irq(data, dev);
746
747 ret = cc2_request_ready_irq(data, dev);
750 if (ret) {
751 dev_err_probe(dev, ret, "Failed to request ready irq\n");
752 return ret;
753 }
748 if (ret)
749 return dev_err_probe(dev, ret, "Failed to request ready irq\n");
754
755 ret = cc2_request_alarm_irqs(data, dev);
750
751 ret = cc2_request_alarm_irqs(data, dev);
756 if (ret) {
757 dev_err_probe(dev, ret, "Failed to request alarm irqs\n");
758 goto disable;
759 }
752 if (ret)
753 return dev_err_probe(dev, ret, "Failed to request alarm irqs\n");
760
761 data->hwmon = devm_hwmon_device_register_with_info(dev, client->name,
762 data, &cc2_chip_info,
763 NULL);
754
755 data->hwmon = devm_hwmon_device_register_with_info(dev, client->name,
756 data, &cc2_chip_info,
757 NULL);
764 if (IS_ERR(data->hwmon)) {
765 dev_err_probe(dev, PTR_ERR(data->hwmon),
766 "Failed to register hwmon device\n");
767 ret = PTR_ERR(data->hwmon);
768 }
758 if (IS_ERR(data->hwmon))
759 return dev_err_probe(dev, PTR_ERR(data->hwmon),
760 "Failed to register hwmon device\n");
769
761
770disable:
771 cc2_disable(data);
772
773 return ret;
762 return 0;
774}
775
776static void cc2_remove(struct i2c_client *client)
777{
778 struct cc2_data *data = i2c_get_clientdata(client);
779
780 cc2_disable(data);
781}

--- 41 unchanged lines hidden ---
763}
764
765static void cc2_remove(struct i2c_client *client)
766{
767 struct cc2_data *data = i2c_get_clientdata(client);
768
769 cc2_disable(data);
770}

--- 41 unchanged lines hidden ---