Source
168
168
data->fault[i]
169
169
= i2c_smbus_read_byte_data(client, MAX16065_FAULT(i));
170
170
171
171
data->last_updated = jiffies;
172
172
data->valid = 1;
173
173
}
174
174
mutex_unlock(&data->update_lock);
175
175
return data;
176
176
}
177
177
178
-
static ssize_t max16065_show_alarm(struct device *dev,
178
+
static ssize_t max16065_alarm_show(struct device *dev,
179
179
struct device_attribute *da, char *buf)
180
180
{
181
181
struct sensor_device_attribute_2 *attr2 = to_sensor_dev_attr_2(da);
182
182
struct max16065_data *data = max16065_update_device(dev);
183
183
int val = data->fault[attr2->nr];
184
184
185
185
if (val < 0)
186
186
return val;
187
187
188
188
val &= (1 << attr2->index);
189
189
if (val)
190
190
i2c_smbus_write_byte_data(data->client,
191
191
MAX16065_FAULT(attr2->nr), val);
192
192
193
193
return snprintf(buf, PAGE_SIZE, "%d\n", !!val);
194
194
}
195
195
196
-
static ssize_t max16065_show_input(struct device *dev,
196
+
static ssize_t max16065_input_show(struct device *dev,
197
197
struct device_attribute *da, char *buf)
198
198
{
199
199
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
200
200
struct max16065_data *data = max16065_update_device(dev);
201
201
int adc = data->adc[attr->index];
202
202
203
203
if (unlikely(adc < 0))
204
204
return adc;
205
205
206
206
return snprintf(buf, PAGE_SIZE, "%d\n",
207
207
ADC_TO_MV(adc, data->range[attr->index]));
208
208
}
209
209
210
-
static ssize_t max16065_show_current(struct device *dev,
210
+
static ssize_t max16065_current_show(struct device *dev,
211
211
struct device_attribute *da, char *buf)
212
212
{
213
213
struct max16065_data *data = max16065_update_device(dev);
214
214
215
215
if (unlikely(data->curr_sense < 0))
216
216
return data->curr_sense;
217
217
218
218
return snprintf(buf, PAGE_SIZE, "%d\n",
219
219
ADC_TO_CURR(data->curr_sense, data->curr_gain));
220
220
}
221
221
222
-
static ssize_t max16065_set_limit(struct device *dev,
223
-
struct device_attribute *da,
224
-
const char *buf, size_t count)
222
+
static ssize_t max16065_limit_store(struct device *dev,
223
+
struct device_attribute *da,
224
+
const char *buf, size_t count)
225
225
{
226
226
struct sensor_device_attribute_2 *attr2 = to_sensor_dev_attr_2(da);
227
227
struct max16065_data *data = dev_get_drvdata(dev);
228
228
unsigned long val;
229
229
int err;
230
230
int limit;
231
231
232
232
err = kstrtoul(buf, 10, &val);
233
233
if (unlikely(err < 0))
234
234
return err;
239
239
data->limit[attr2->nr][attr2->index]
240
240
= LIMIT_TO_MV(limit, data->range[attr2->index]);
241
241
i2c_smbus_write_byte_data(data->client,
242
242
MAX16065_LIMIT(attr2->nr, attr2->index),
243
243
limit);
244
244
mutex_unlock(&data->update_lock);
245
245
246
246
return count;
247
247
}
248
248
249
-
static ssize_t max16065_show_limit(struct device *dev,
249
+
static ssize_t max16065_limit_show(struct device *dev,
250
250
struct device_attribute *da, char *buf)
251
251
{
252
252
struct sensor_device_attribute_2 *attr2 = to_sensor_dev_attr_2(da);
253
253
struct max16065_data *data = dev_get_drvdata(dev);
254
254
255
255
return snprintf(buf, PAGE_SIZE, "%d\n",
256
256
data->limit[attr2->nr][attr2->index]);
257
257
}
258
258
259
259
/* Construct a sensor_device_attribute structure for each register */
260
260
261
261
/* Input voltages */
262
-
static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, max16065_show_input, NULL, 0);
263
-
static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, max16065_show_input, NULL, 1);
264
-
static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, max16065_show_input, NULL, 2);
265
-
static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, max16065_show_input, NULL, 3);
266
-
static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, max16065_show_input, NULL, 4);
267
-
static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, max16065_show_input, NULL, 5);
268
-
static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, max16065_show_input, NULL, 6);
269
-
static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, max16065_show_input, NULL, 7);
270
-
static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, max16065_show_input, NULL, 8);
271
-
static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, max16065_show_input, NULL, 9);
272
-
static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, max16065_show_input, NULL, 10);
273
-
static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, max16065_show_input, NULL, 11);
274
-
static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, max16065_show_input, NULL, 12);
262
+
static SENSOR_DEVICE_ATTR_RO(in0_input, max16065_input, 0);
263
+
static SENSOR_DEVICE_ATTR_RO(in1_input, max16065_input, 1);
264
+
static SENSOR_DEVICE_ATTR_RO(in2_input, max16065_input, 2);
265
+
static SENSOR_DEVICE_ATTR_RO(in3_input, max16065_input, 3);
266
+
static SENSOR_DEVICE_ATTR_RO(in4_input, max16065_input, 4);
267
+
static SENSOR_DEVICE_ATTR_RO(in5_input, max16065_input, 5);
268
+
static SENSOR_DEVICE_ATTR_RO(in6_input, max16065_input, 6);
269
+
static SENSOR_DEVICE_ATTR_RO(in7_input, max16065_input, 7);
270
+
static SENSOR_DEVICE_ATTR_RO(in8_input, max16065_input, 8);
271
+
static SENSOR_DEVICE_ATTR_RO(in9_input, max16065_input, 9);
272
+
static SENSOR_DEVICE_ATTR_RO(in10_input, max16065_input, 10);
273
+
static SENSOR_DEVICE_ATTR_RO(in11_input, max16065_input, 11);
274
+
static SENSOR_DEVICE_ATTR_RO(in12_input, max16065_input, 12);
275
275
276
276
/* Input voltages lcrit */
277
-
static SENSOR_DEVICE_ATTR_2(in0_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
278
-
max16065_set_limit, 2, 0);
279
-
static SENSOR_DEVICE_ATTR_2(in1_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
280
-
max16065_set_limit, 2, 1);
281
-
static SENSOR_DEVICE_ATTR_2(in2_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
282
-
max16065_set_limit, 2, 2);
283
-
static SENSOR_DEVICE_ATTR_2(in3_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
284
-
max16065_set_limit, 2, 3);
285
-
static SENSOR_DEVICE_ATTR_2(in4_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
286
-
max16065_set_limit, 2, 4);
287
-
static SENSOR_DEVICE_ATTR_2(in5_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
288
-
max16065_set_limit, 2, 5);
289
-
static SENSOR_DEVICE_ATTR_2(in6_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
290
-
max16065_set_limit, 2, 6);
291
-
static SENSOR_DEVICE_ATTR_2(in7_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
292
-
max16065_set_limit, 2, 7);
293
-
static SENSOR_DEVICE_ATTR_2(in8_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
294
-
max16065_set_limit, 2, 8);
295
-
static SENSOR_DEVICE_ATTR_2(in9_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
296
-
max16065_set_limit, 2, 9);
297
-
static SENSOR_DEVICE_ATTR_2(in10_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
298
-
max16065_set_limit, 2, 10);
299
-
static SENSOR_DEVICE_ATTR_2(in11_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit,
300
-
max16065_set_limit, 2, 11);
277
+
static SENSOR_DEVICE_ATTR_2_RW(in0_lcrit, max16065_limit, 2, 0);
278
+
static SENSOR_DEVICE_ATTR_2_RW(in1_lcrit, max16065_limit, 2, 1);
279
+
static SENSOR_DEVICE_ATTR_2_RW(in2_lcrit, max16065_limit, 2, 2);
280
+
static SENSOR_DEVICE_ATTR_2_RW(in3_lcrit, max16065_limit, 2, 3);
281
+
static SENSOR_DEVICE_ATTR_2_RW(in4_lcrit, max16065_limit, 2, 4);
282
+
static SENSOR_DEVICE_ATTR_2_RW(in5_lcrit, max16065_limit, 2, 5);
283
+
static SENSOR_DEVICE_ATTR_2_RW(in6_lcrit, max16065_limit, 2, 6);
284
+
static SENSOR_DEVICE_ATTR_2_RW(in7_lcrit, max16065_limit, 2, 7);
285
+
static SENSOR_DEVICE_ATTR_2_RW(in8_lcrit, max16065_limit, 2, 8);
286
+
static SENSOR_DEVICE_ATTR_2_RW(in9_lcrit, max16065_limit, 2, 9);
287
+
static SENSOR_DEVICE_ATTR_2_RW(in10_lcrit, max16065_limit, 2, 10);
288
+
static SENSOR_DEVICE_ATTR_2_RW(in11_lcrit, max16065_limit, 2, 11);
301
289
302
290
/* Input voltages crit */
303
-
static SENSOR_DEVICE_ATTR_2(in0_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
304
-
max16065_set_limit, 1, 0);
305
-
static SENSOR_DEVICE_ATTR_2(in1_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
306
-
max16065_set_limit, 1, 1);
307
-
static SENSOR_DEVICE_ATTR_2(in2_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
308
-
max16065_set_limit, 1, 2);
309
-
static SENSOR_DEVICE_ATTR_2(in3_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
310
-
max16065_set_limit, 1, 3);
311
-
static SENSOR_DEVICE_ATTR_2(in4_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
312
-
max16065_set_limit, 1, 4);
313
-
static SENSOR_DEVICE_ATTR_2(in5_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
314
-
max16065_set_limit, 1, 5);
315
-
static SENSOR_DEVICE_ATTR_2(in6_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
316
-
max16065_set_limit, 1, 6);
317
-
static SENSOR_DEVICE_ATTR_2(in7_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
318
-
max16065_set_limit, 1, 7);
319
-
static SENSOR_DEVICE_ATTR_2(in8_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
320
-
max16065_set_limit, 1, 8);
321
-
static SENSOR_DEVICE_ATTR_2(in9_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
322
-
max16065_set_limit, 1, 9);
323
-
static SENSOR_DEVICE_ATTR_2(in10_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
324
-
max16065_set_limit, 1, 10);
325
-
static SENSOR_DEVICE_ATTR_2(in11_crit, S_IWUSR | S_IRUGO, max16065_show_limit,
326
-
max16065_set_limit, 1, 11);
291
+
static SENSOR_DEVICE_ATTR_2_RW(in0_crit, max16065_limit, 1, 0);
292
+
static SENSOR_DEVICE_ATTR_2_RW(in1_crit, max16065_limit, 1, 1);
293
+
static SENSOR_DEVICE_ATTR_2_RW(in2_crit, max16065_limit, 1, 2);
294
+
static SENSOR_DEVICE_ATTR_2_RW(in3_crit, max16065_limit, 1, 3);
295
+
static SENSOR_DEVICE_ATTR_2_RW(in4_crit, max16065_limit, 1, 4);
296
+
static SENSOR_DEVICE_ATTR_2_RW(in5_crit, max16065_limit, 1, 5);
297
+
static SENSOR_DEVICE_ATTR_2_RW(in6_crit, max16065_limit, 1, 6);
298
+
static SENSOR_DEVICE_ATTR_2_RW(in7_crit, max16065_limit, 1, 7);
299
+
static SENSOR_DEVICE_ATTR_2_RW(in8_crit, max16065_limit, 1, 8);
300
+
static SENSOR_DEVICE_ATTR_2_RW(in9_crit, max16065_limit, 1, 9);
301
+
static SENSOR_DEVICE_ATTR_2_RW(in10_crit, max16065_limit, 1, 10);
302
+
static SENSOR_DEVICE_ATTR_2_RW(in11_crit, max16065_limit, 1, 11);
327
303
328
304
/* Input voltages min */
329
-
static SENSOR_DEVICE_ATTR_2(in0_min, S_IWUSR | S_IRUGO, max16065_show_limit,
330
-
max16065_set_limit, 0, 0);
331
-
static SENSOR_DEVICE_ATTR_2(in1_min, S_IWUSR | S_IRUGO, max16065_show_limit,
332
-
max16065_set_limit, 0, 1);
333
-
static SENSOR_DEVICE_ATTR_2(in2_min, S_IWUSR | S_IRUGO, max16065_show_limit,
334
-
max16065_set_limit, 0, 2);
335
-
static SENSOR_DEVICE_ATTR_2(in3_min, S_IWUSR | S_IRUGO, max16065_show_limit,
336
-
max16065_set_limit, 0, 3);
337
-
static SENSOR_DEVICE_ATTR_2(in4_min, S_IWUSR | S_IRUGO, max16065_show_limit,
338
-
max16065_set_limit, 0, 4);
339
-
static SENSOR_DEVICE_ATTR_2(in5_min, S_IWUSR | S_IRUGO, max16065_show_limit,
340
-
max16065_set_limit, 0, 5);
341
-
static SENSOR_DEVICE_ATTR_2(in6_min, S_IWUSR | S_IRUGO, max16065_show_limit,
342
-
max16065_set_limit, 0, 6);
343
-
static SENSOR_DEVICE_ATTR_2(in7_min, S_IWUSR | S_IRUGO, max16065_show_limit,
344
-
max16065_set_limit, 0, 7);
345
-
static SENSOR_DEVICE_ATTR_2(in8_min, S_IWUSR | S_IRUGO, max16065_show_limit,
346
-
max16065_set_limit, 0, 8);
347
-
static SENSOR_DEVICE_ATTR_2(in9_min, S_IWUSR | S_IRUGO, max16065_show_limit,
348
-
max16065_set_limit, 0, 9);
349
-
static SENSOR_DEVICE_ATTR_2(in10_min, S_IWUSR | S_IRUGO, max16065_show_limit,
350
-
max16065_set_limit, 0, 10);
351
-
static SENSOR_DEVICE_ATTR_2(in11_min, S_IWUSR | S_IRUGO, max16065_show_limit,
352
-
max16065_set_limit, 0, 11);
305
+
static SENSOR_DEVICE_ATTR_2_RW(in0_min, max16065_limit, 0, 0);
306
+
static SENSOR_DEVICE_ATTR_2_RW(in1_min, max16065_limit, 0, 1);
307
+
static SENSOR_DEVICE_ATTR_2_RW(in2_min, max16065_limit, 0, 2);
308
+
static SENSOR_DEVICE_ATTR_2_RW(in3_min, max16065_limit, 0, 3);
309
+
static SENSOR_DEVICE_ATTR_2_RW(in4_min, max16065_limit, 0, 4);
310
+
static SENSOR_DEVICE_ATTR_2_RW(in5_min, max16065_limit, 0, 5);
311
+
static SENSOR_DEVICE_ATTR_2_RW(in6_min, max16065_limit, 0, 6);
312
+
static SENSOR_DEVICE_ATTR_2_RW(in7_min, max16065_limit, 0, 7);
313
+
static SENSOR_DEVICE_ATTR_2_RW(in8_min, max16065_limit, 0, 8);
314
+
static SENSOR_DEVICE_ATTR_2_RW(in9_min, max16065_limit, 0, 9);
315
+
static SENSOR_DEVICE_ATTR_2_RW(in10_min, max16065_limit, 0, 10);
316
+
static SENSOR_DEVICE_ATTR_2_RW(in11_min, max16065_limit, 0, 11);
353
317
354
318
/* Input voltages max */
355
-
static SENSOR_DEVICE_ATTR_2(in0_max, S_IWUSR | S_IRUGO, max16065_show_limit,
356
-
max16065_set_limit, 0, 0);
357
-
static SENSOR_DEVICE_ATTR_2(in1_max, S_IWUSR | S_IRUGO, max16065_show_limit,
358
-
max16065_set_limit, 0, 1);
359
-
static SENSOR_DEVICE_ATTR_2(in2_max, S_IWUSR | S_IRUGO, max16065_show_limit,
360
-
max16065_set_limit, 0, 2);
361
-
static SENSOR_DEVICE_ATTR_2(in3_max, S_IWUSR | S_IRUGO, max16065_show_limit,
362
-
max16065_set_limit, 0, 3);
363
-
static SENSOR_DEVICE_ATTR_2(in4_max, S_IWUSR | S_IRUGO, max16065_show_limit,
364
-
max16065_set_limit, 0, 4);
365
-
static SENSOR_DEVICE_ATTR_2(in5_max, S_IWUSR | S_IRUGO, max16065_show_limit,
366
-
max16065_set_limit, 0, 5);
367
-
static SENSOR_DEVICE_ATTR_2(in6_max, S_IWUSR | S_IRUGO, max16065_show_limit,
368
-
max16065_set_limit, 0, 6);
369
-
static SENSOR_DEVICE_ATTR_2(in7_max, S_IWUSR | S_IRUGO, max16065_show_limit,
370
-
max16065_set_limit, 0, 7);
371
-
static SENSOR_DEVICE_ATTR_2(in8_max, S_IWUSR | S_IRUGO, max16065_show_limit,
372
-
max16065_set_limit, 0, 8);
373
-
static SENSOR_DEVICE_ATTR_2(in9_max, S_IWUSR | S_IRUGO, max16065_show_limit,
374
-
max16065_set_limit, 0, 9);
375
-
static SENSOR_DEVICE_ATTR_2(in10_max, S_IWUSR | S_IRUGO, max16065_show_limit,
376
-
max16065_set_limit, 0, 10);
377
-
static SENSOR_DEVICE_ATTR_2(in11_max, S_IWUSR | S_IRUGO, max16065_show_limit,
378
-
max16065_set_limit, 0, 11);
319
+
static SENSOR_DEVICE_ATTR_2_RW(in0_max, max16065_limit, 0, 0);
320
+
static SENSOR_DEVICE_ATTR_2_RW(in1_max, max16065_limit, 0, 1);
321
+
static SENSOR_DEVICE_ATTR_2_RW(in2_max, max16065_limit, 0, 2);
322
+
static SENSOR_DEVICE_ATTR_2_RW(in3_max, max16065_limit, 0, 3);
323
+
static SENSOR_DEVICE_ATTR_2_RW(in4_max, max16065_limit, 0, 4);
324
+
static SENSOR_DEVICE_ATTR_2_RW(in5_max, max16065_limit, 0, 5);
325
+
static SENSOR_DEVICE_ATTR_2_RW(in6_max, max16065_limit, 0, 6);
326
+
static SENSOR_DEVICE_ATTR_2_RW(in7_max, max16065_limit, 0, 7);
327
+
static SENSOR_DEVICE_ATTR_2_RW(in8_max, max16065_limit, 0, 8);
328
+
static SENSOR_DEVICE_ATTR_2_RW(in9_max, max16065_limit, 0, 9);
329
+
static SENSOR_DEVICE_ATTR_2_RW(in10_max, max16065_limit, 0, 10);
330
+
static SENSOR_DEVICE_ATTR_2_RW(in11_max, max16065_limit, 0, 11);
379
331
380
332
/* alarms */
381
-
static SENSOR_DEVICE_ATTR_2(in0_alarm, S_IRUGO, max16065_show_alarm, NULL,
382
-
0, 0);
383
-
static SENSOR_DEVICE_ATTR_2(in1_alarm, S_IRUGO, max16065_show_alarm, NULL,
384
-
0, 1);
385
-
static SENSOR_DEVICE_ATTR_2(in2_alarm, S_IRUGO, max16065_show_alarm, NULL,
386
-
0, 2);
387
-
static SENSOR_DEVICE_ATTR_2(in3_alarm, S_IRUGO, max16065_show_alarm, NULL,
388
-
0, 3);
389
-
static SENSOR_DEVICE_ATTR_2(in4_alarm, S_IRUGO, max16065_show_alarm, NULL,
390
-
0, 4);
391
-
static SENSOR_DEVICE_ATTR_2(in5_alarm, S_IRUGO, max16065_show_alarm, NULL,
392
-
0, 5);
393
-
static SENSOR_DEVICE_ATTR_2(in6_alarm, S_IRUGO, max16065_show_alarm, NULL,
394
-
0, 6);
395
-
static SENSOR_DEVICE_ATTR_2(in7_alarm, S_IRUGO, max16065_show_alarm, NULL,
396
-
0, 7);
397
-
static SENSOR_DEVICE_ATTR_2(in8_alarm, S_IRUGO, max16065_show_alarm, NULL,
398
-
1, 0);
399
-
static SENSOR_DEVICE_ATTR_2(in9_alarm, S_IRUGO, max16065_show_alarm, NULL,
400
-
1, 1);
401
-
static SENSOR_DEVICE_ATTR_2(in10_alarm, S_IRUGO, max16065_show_alarm, NULL,
402
-
1, 2);
403
-
static SENSOR_DEVICE_ATTR_2(in11_alarm, S_IRUGO, max16065_show_alarm, NULL,
404
-
1, 3);
333
+
static SENSOR_DEVICE_ATTR_2_RO(in0_alarm, max16065_alarm, 0, 0);
334
+
static SENSOR_DEVICE_ATTR_2_RO(in1_alarm, max16065_alarm, 0, 1);
335
+
static SENSOR_DEVICE_ATTR_2_RO(in2_alarm, max16065_alarm, 0, 2);
336
+
static SENSOR_DEVICE_ATTR_2_RO(in3_alarm, max16065_alarm, 0, 3);
337
+
static SENSOR_DEVICE_ATTR_2_RO(in4_alarm, max16065_alarm, 0, 4);
338
+
static SENSOR_DEVICE_ATTR_2_RO(in5_alarm, max16065_alarm, 0, 5);
339
+
static SENSOR_DEVICE_ATTR_2_RO(in6_alarm, max16065_alarm, 0, 6);
340
+
static SENSOR_DEVICE_ATTR_2_RO(in7_alarm, max16065_alarm, 0, 7);
341
+
static SENSOR_DEVICE_ATTR_2_RO(in8_alarm, max16065_alarm, 1, 0);
342
+
static SENSOR_DEVICE_ATTR_2_RO(in9_alarm, max16065_alarm, 1, 1);
343
+
static SENSOR_DEVICE_ATTR_2_RO(in10_alarm, max16065_alarm, 1, 2);
344
+
static SENSOR_DEVICE_ATTR_2_RO(in11_alarm, max16065_alarm, 1, 3);
405
345
406
346
/* Current and alarm */
407
-
static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, max16065_show_current, NULL, 0);
408
-
static SENSOR_DEVICE_ATTR_2(curr1_alarm, S_IRUGO, max16065_show_alarm, NULL,
409
-
1, 4);
347
+
static SENSOR_DEVICE_ATTR_RO(curr1_input, max16065_current, 0);
348
+
static SENSOR_DEVICE_ATTR_2_RO(curr1_alarm, max16065_alarm, 1, 4);
410
349
411
350
/*
412
351
* Finally, construct an array of pointers to members of the above objects,
413
352
* as required for sysfs_create_group()
414
353
*/
415
354
static struct attribute *max16065_basic_attributes[] = {
416
355
&sensor_dev_attr_in0_input.dev_attr.attr,
417
356
&sensor_dev_attr_in0_lcrit.dev_attr.attr,
418
357
&sensor_dev_attr_in0_crit.dev_attr.attr,
419
358
&sensor_dev_attr_in0_alarm.dev_attr.attr,