| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2008, 2010 Davide Rizzo <elpa.rizzo@gmail.com> |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * It reports up to three temperatures (its own plus up to two external ones). |
|---|
| 6 | 7 | * Complete datasheet can be obtained from National's website at: |
|---|
| 7 | 8 | * http://www.national.com/ds.cgi/LM/LM95241.pdf |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 11 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 12 | | - * (at your option) any later version. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | | - * GNU General Public License for more details. |
|---|
| 18 | 9 | */ |
|---|
| 19 | 10 | |
|---|
| 20 | 11 | #include <linux/bitops.h> |
|---|
| .. | .. |
|---|
| 349 | 340 | case hwmon_chip: |
|---|
| 350 | 341 | switch (attr) { |
|---|
| 351 | 342 | case hwmon_chip_update_interval: |
|---|
| 352 | | - return S_IRUGO | S_IWUSR; |
|---|
| 343 | + return 0644; |
|---|
| 353 | 344 | } |
|---|
| 354 | 345 | break; |
|---|
| 355 | 346 | case hwmon_temp: |
|---|
| 356 | 347 | switch (attr) { |
|---|
| 357 | 348 | case hwmon_temp_input: |
|---|
| 358 | | - return S_IRUGO; |
|---|
| 349 | + return 0444; |
|---|
| 359 | 350 | case hwmon_temp_fault: |
|---|
| 360 | | - return S_IRUGO; |
|---|
| 351 | + return 0444; |
|---|
| 361 | 352 | case hwmon_temp_min: |
|---|
| 362 | 353 | case hwmon_temp_max: |
|---|
| 363 | 354 | case hwmon_temp_type: |
|---|
| 364 | | - return S_IRUGO | S_IWUSR; |
|---|
| 355 | + return 0644; |
|---|
| 365 | 356 | } |
|---|
| 366 | 357 | break; |
|---|
| 367 | 358 | default: |
|---|
| .. | .. |
|---|
| 418 | 409 | data->model); |
|---|
| 419 | 410 | } |
|---|
| 420 | 411 | |
|---|
| 421 | | -static const u32 lm95241_chip_config[] = { |
|---|
| 422 | | - HWMON_C_UPDATE_INTERVAL, |
|---|
| 423 | | - 0 |
|---|
| 424 | | -}; |
|---|
| 425 | | - |
|---|
| 426 | | -static const struct hwmon_channel_info lm95241_chip = { |
|---|
| 427 | | - .type = hwmon_chip, |
|---|
| 428 | | - .config = lm95241_chip_config, |
|---|
| 429 | | -}; |
|---|
| 430 | | - |
|---|
| 431 | | -static const u32 lm95241_temp_config[] = { |
|---|
| 432 | | - HWMON_T_INPUT, |
|---|
| 433 | | - HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MIN | HWMON_T_TYPE | |
|---|
| 434 | | - HWMON_T_FAULT, |
|---|
| 435 | | - HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MIN | HWMON_T_TYPE | |
|---|
| 436 | | - HWMON_T_FAULT, |
|---|
| 437 | | - 0 |
|---|
| 438 | | -}; |
|---|
| 439 | | - |
|---|
| 440 | | -static const struct hwmon_channel_info lm95241_temp = { |
|---|
| 441 | | - .type = hwmon_temp, |
|---|
| 442 | | - .config = lm95241_temp_config, |
|---|
| 443 | | -}; |
|---|
| 444 | | - |
|---|
| 445 | 412 | static const struct hwmon_channel_info *lm95241_info[] = { |
|---|
| 446 | | - &lm95241_chip, |
|---|
| 447 | | - &lm95241_temp, |
|---|
| 413 | + HWMON_CHANNEL_INFO(chip, |
|---|
| 414 | + HWMON_C_UPDATE_INTERVAL), |
|---|
| 415 | + HWMON_CHANNEL_INFO(temp, |
|---|
| 416 | + HWMON_T_INPUT, |
|---|
| 417 | + HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MIN | |
|---|
| 418 | + HWMON_T_TYPE | HWMON_T_FAULT, |
|---|
| 419 | + HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MIN | |
|---|
| 420 | + HWMON_T_TYPE | HWMON_T_FAULT), |
|---|
| 448 | 421 | NULL |
|---|
| 449 | 422 | }; |
|---|
| 450 | 423 | |
|---|
| .. | .. |
|---|
| 459 | 432 | .info = lm95241_info, |
|---|
| 460 | 433 | }; |
|---|
| 461 | 434 | |
|---|
| 462 | | -static int lm95241_probe(struct i2c_client *client, |
|---|
| 463 | | - const struct i2c_device_id *id) |
|---|
| 435 | +static int lm95241_probe(struct i2c_client *client) |
|---|
| 464 | 436 | { |
|---|
| 465 | 437 | struct device *dev = &client->dev; |
|---|
| 466 | 438 | struct lm95241_data *data; |
|---|
| .. | .. |
|---|
| 496 | 468 | .driver = { |
|---|
| 497 | 469 | .name = DEVNAME, |
|---|
| 498 | 470 | }, |
|---|
| 499 | | - .probe = lm95241_probe, |
|---|
| 471 | + .probe_new = lm95241_probe, |
|---|
| 500 | 472 | .id_table = lm95241_id, |
|---|
| 501 | 473 | .detect = lm95241_detect, |
|---|
| 502 | 474 | .address_list = normal_i2c, |
|---|