ms5637.c (34069d12e239ae8f36dd96c378e4622fb1c42a76) | ms5637.c (22da192f43f7d302d02644efa192ba5a05d935c9) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * ms5637.c - Support for Measurement-Specialties MS5637, MS5805 4 * MS5837 and MS8607 pressure & temperature sensor 5 * 6 * Copyright (c) 2015 Measurement-Specialties 7 * 8 * (7-bit I2C slave address 0x76) --- 130 unchanged lines hidden (view full) --- 139static const struct iio_info ms5637_info = { 140 .read_raw = ms5637_read_raw, 141 .write_raw = ms5637_write_raw, 142 .attrs = &ms5637_attribute_group, 143}; 144 145static int ms5637_probe(struct i2c_client *client) 146{ | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * ms5637.c - Support for Measurement-Specialties MS5637, MS5805 4 * MS5837 and MS8607 pressure & temperature sensor 5 * 6 * Copyright (c) 2015 Measurement-Specialties 7 * 8 * (7-bit I2C slave address 0x76) --- 130 unchanged lines hidden (view full) --- 139static const struct iio_info ms5637_info = { 140 .read_raw = ms5637_read_raw, 141 .write_raw = ms5637_write_raw, 142 .attrs = &ms5637_attribute_group, 143}; 144 145static int ms5637_probe(struct i2c_client *client) 146{ |
147 const struct i2c_device_id *id = i2c_client_get_device_id(client); | |
148 const struct ms_tp_data *data; 149 struct ms_tp_dev *dev_data; 150 struct iio_dev *indio_dev; 151 int ret; 152 153 if (!i2c_check_functionality(client->adapter, 154 I2C_FUNC_SMBUS_READ_WORD_DATA | 155 I2C_FUNC_SMBUS_WRITE_BYTE | 156 I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { 157 dev_err(&client->dev, 158 "Adapter does not support some i2c transaction\n"); 159 return -EOPNOTSUPP; 160 } 161 | 147 const struct ms_tp_data *data; 148 struct ms_tp_dev *dev_data; 149 struct iio_dev *indio_dev; 150 int ret; 151 152 if (!i2c_check_functionality(client->adapter, 153 I2C_FUNC_SMBUS_READ_WORD_DATA | 154 I2C_FUNC_SMBUS_WRITE_BYTE | 155 I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { 156 dev_err(&client->dev, 157 "Adapter does not support some i2c transaction\n"); 158 return -EOPNOTSUPP; 159 } 160 |
162 if (id) 163 data = (const struct ms_tp_data *)id->driver_data; 164 else 165 data = device_get_match_data(&client->dev); | 161 data = i2c_get_match_data(client); |
166 if (!data) 167 return -EINVAL; 168 169 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data)); 170 if (!indio_dev) 171 return -ENOMEM; 172 173 dev_data = iio_priv(indio_dev); --- 82 unchanged lines hidden --- | 162 if (!data) 163 return -EINVAL; 164 165 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*dev_data)); 166 if (!indio_dev) 167 return -ENOMEM; 168 169 dev_data = iio_priv(indio_dev); --- 82 unchanged lines hidden --- |