diff options
author | Hans de Goede <hdegoede@redhat.com> | 2009-01-07 10:37:28 -0500 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-01-07 10:37:28 -0500 |
commit | 3cc74758a667c5ad46fa5d6810ce701095370d35 (patch) | |
tree | f4771ef72e84fa5a9d83ae16269d23a0a1454656 /drivers | |
parent | 498be96834bf88a44db2f4a3115688c882e6f3e3 (diff) |
hwmon: (f71882fg) Move some io access from the detect to the probe function
The f71882fg driver did some io to ioports it hadn't reserved yet in its
find (detect) function, this patches moves this io to the probe function
where these ports are reserved and this io belongs.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/f71882fg.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index cdd16d4966c3..1cfd2231677a 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -1507,12 +1507,31 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
1507 | mutex_init(&data->update_lock); | 1507 | mutex_init(&data->update_lock); |
1508 | platform_set_drvdata(pdev, data); | 1508 | platform_set_drvdata(pdev, data); |
1509 | 1509 | ||
1510 | start_reg = f71882fg_read8(data, F71882FG_REG_START); | ||
1511 | if (!(start_reg & 0x03)) { | ||
1512 | dev_warn(&pdev->dev, "Hardware monitoring not activated\n"); | ||
1513 | err = -ENODEV; | ||
1514 | goto exit_free; | ||
1515 | } | ||
1516 | |||
1517 | /* If it is a 71862 and the fan / pwm part is enabled sanity check | ||
1518 | the pwm settings */ | ||
1519 | if (data->type == f71862fg && (start_reg & 0x02)) { | ||
1520 | u8 reg = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE); | ||
1521 | if ((reg & 0x15) != 0x15) { | ||
1522 | dev_err(&pdev->dev, | ||
1523 | "Invalid (reserved) pwm settings: 0x%02x\n", | ||
1524 | (unsigned int)reg); | ||
1525 | err = -ENODEV; | ||
1526 | goto exit_free; | ||
1527 | } | ||
1528 | } | ||
1529 | |||
1510 | /* Register sysfs interface files */ | 1530 | /* Register sysfs interface files */ |
1511 | err = device_create_file(&pdev->dev, &dev_attr_name); | 1531 | err = device_create_file(&pdev->dev, &dev_attr_name); |
1512 | if (err) | 1532 | if (err) |
1513 | goto exit_unregister_sysfs; | 1533 | goto exit_unregister_sysfs; |
1514 | 1534 | ||
1515 | start_reg = f71882fg_read8(data, F71882FG_REG_START); | ||
1516 | if (start_reg & 0x01) { | 1535 | if (start_reg & 0x01) { |
1517 | err = f71882fg_create_sysfs_files(pdev, f718x2fg_in_temp_attr, | 1536 | err = f71882fg_create_sysfs_files(pdev, f718x2fg_in_temp_attr, |
1518 | ARRAY_SIZE(f718x2fg_in_temp_attr)); | 1537 | ARRAY_SIZE(f718x2fg_in_temp_attr)); |
@@ -1558,7 +1577,9 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
1558 | 1577 | ||
1559 | exit_unregister_sysfs: | 1578 | exit_unregister_sysfs: |
1560 | f71882fg_remove(pdev); /* Will unregister the sysfs files for us */ | 1579 | f71882fg_remove(pdev); /* Will unregister the sysfs files for us */ |
1561 | 1580 | return err; /* f71882fg_remove() also frees our data */ | |
1581 | exit_free: | ||
1582 | kfree(data); | ||
1562 | return err; | 1583 | return err; |
1563 | } | 1584 | } |
1564 | 1585 | ||
@@ -1600,8 +1621,6 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
1600 | { | 1621 | { |
1601 | int err = -ENODEV; | 1622 | int err = -ENODEV; |
1602 | u16 devid; | 1623 | u16 devid; |
1603 | u8 reg; | ||
1604 | struct f71882fg_data data; | ||
1605 | 1624 | ||
1606 | superio_enter(sioaddr); | 1625 | superio_enter(sioaddr); |
1607 | 1626 | ||
@@ -1638,25 +1657,6 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
1638 | } | 1657 | } |
1639 | *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ | 1658 | *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ |
1640 | 1659 | ||
1641 | data.addr = *address; | ||
1642 | reg = f71882fg_read8(&data, F71882FG_REG_START); | ||
1643 | if (!(reg & 0x03)) { | ||
1644 | printk(KERN_WARNING DRVNAME | ||
1645 | ": Hardware monitoring not activated\n"); | ||
1646 | goto exit; | ||
1647 | } | ||
1648 | |||
1649 | /* If it is a 71862 and the fan / pwm part is enabled sanity check | ||
1650 | the pwm settings */ | ||
1651 | if (sio_data->type == f71862fg && (reg & 0x02)) { | ||
1652 | reg = f71882fg_read8(&data, F71882FG_REG_PWM_ENABLE); | ||
1653 | if ((reg & 0x15) != 0x15) { | ||
1654 | printk(KERN_ERR DRVNAME | ||
1655 | ": Invalid (reserved) pwm settings: 0x%02x\n", | ||
1656 | (unsigned int)reg); | ||
1657 | goto exit; | ||
1658 | } | ||
1659 | } | ||
1660 | err = 0; | 1660 | err = 0; |
1661 | printk(KERN_INFO DRVNAME ": Found %s chip at %#x, revision %d\n", | 1661 | printk(KERN_INFO DRVNAME ": Found %s chip at %#x, revision %d\n", |
1662 | f71882fg_names[sio_data->type], (unsigned int)*address, | 1662 | f71882fg_names[sio_data->type], (unsigned int)*address, |