cm32181.c (585a78c1f77be305b1f6adad392f16047fb66ffd) | cm32181.c (099cc90a5a62e68b2fe3a42da011ab929b98bf73) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2013 Capella Microsystems Inc. 4 * Author: Kevin Tsai <ktsai@capellamicro.com> 5 */ 6 7#include <linux/acpi.h> 8#include <linux/delay.h> --- 415 unchanged lines hidden (view full) --- 424}; 425 426static const struct iio_info cm32181_info = { 427 .read_raw = &cm32181_read_raw, 428 .write_raw = &cm32181_write_raw, 429 .attrs = &cm32181_attribute_group, 430}; 431 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2013 Capella Microsystems Inc. 4 * Author: Kevin Tsai <ktsai@capellamicro.com> 5 */ 6 7#include <linux/acpi.h> 8#include <linux/delay.h> --- 415 unchanged lines hidden (view full) --- 424}; 425 426static const struct iio_info cm32181_info = { 427 .read_raw = &cm32181_read_raw, 428 .write_raw = &cm32181_write_raw, 429 .attrs = &cm32181_attribute_group, 430}; 431 |
432static void cm32181_unregister_dummy_client(void *data) 433{ 434 struct i2c_client *client = data; 435 436 /* Unregister the dummy client */ 437 i2c_unregister_device(client); 438} 439 |
|
432static int cm32181_probe(struct i2c_client *client) 433{ 434 struct device *dev = &client->dev; 435 struct cm32181_chip *cm32181; 436 struct iio_dev *indio_dev; 437 int ret; 438 439 indio_dev = devm_iio_device_alloc(dev, sizeof(*cm32181)); --- 15 unchanged lines hidden (view full) --- 455 if (ACPI_HANDLE(dev) && client->addr == SMBUS_ALERT_RESPONSE_ADDRESS) { 456 struct i2c_board_info board_info = { .type = "dummy" }; 457 458 i2c_smbus_read_byte(client); 459 460 client = i2c_acpi_new_device(dev, 1, &board_info); 461 if (IS_ERR(client)) 462 return PTR_ERR(client); | 440static int cm32181_probe(struct i2c_client *client) 441{ 442 struct device *dev = &client->dev; 443 struct cm32181_chip *cm32181; 444 struct iio_dev *indio_dev; 445 int ret; 446 447 indio_dev = devm_iio_device_alloc(dev, sizeof(*cm32181)); --- 15 unchanged lines hidden (view full) --- 463 if (ACPI_HANDLE(dev) && client->addr == SMBUS_ALERT_RESPONSE_ADDRESS) { 464 struct i2c_board_info board_info = { .type = "dummy" }; 465 466 i2c_smbus_read_byte(client); 467 468 client = i2c_acpi_new_device(dev, 1, &board_info); 469 if (IS_ERR(client)) 470 return PTR_ERR(client); |
471 472 ret = devm_add_action_or_reset(dev, cm32181_unregister_dummy_client, client); 473 if (ret) 474 return ret; |
|
463 } 464 465 cm32181 = iio_priv(indio_dev); 466 cm32181->client = client; 467 cm32181->dev = dev; 468 469 mutex_init(&cm32181->lock); 470 indio_dev->channels = cm32181_channels; --- 70 unchanged lines hidden --- | 475 } 476 477 cm32181 = iio_priv(indio_dev); 478 cm32181->client = client; 479 cm32181->dev = dev; 480 481 mutex_init(&cm32181->lock); 482 indio_dev->channels = cm32181_channels; --- 70 unchanged lines hidden --- |