Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177969
b: refs/heads/master
c: fa0bff0
h: refs/heads/master
i:
  177967: a8ce498
v: v3
  • Loading branch information
Jean Delvare committed Dec 16, 2009
1 parent 22826d5 commit d9d9d7d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3ecf44b312758d10be20539b06b2df5d77d59cdb
refs/heads/master: fa0bff02239abdad446effef22e5db281cf3d562
30 changes: 27 additions & 3 deletions trunk/drivers/hwmon/smsc47m1.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ struct smsc47m1_data {

struct smsc47m1_sio_data {
enum chips type;
u8 activate; /* Remember initial device state */
};


Expand Down Expand Up @@ -468,17 +469,38 @@ static int __init smsc47m1_find(unsigned short *addr,
superio_select();
*addr = (superio_inb(SUPERIO_REG_BASE) << 8)
| superio_inb(SUPERIO_REG_BASE + 1);
val = superio_inb(SUPERIO_REG_ACT);
if (*addr == 0 || (val & 0x01) == 0) {
pr_info(DRVNAME ": Device is disabled, will not use\n");
if (*addr == 0) {
pr_info(DRVNAME ": Device address not set, will not use\n");
superio_exit();
return -ENODEV;
}

/* Enable only if address is set (needed at least on the
* Compaq Presario S4000NX) */
sio_data->activate = superio_inb(SUPERIO_REG_ACT);
if ((sio_data->activate & 0x01) == 0) {
pr_info(DRVNAME ": Enabling device\n");
superio_outb(SUPERIO_REG_ACT, sio_data->activate | 0x01);
}

superio_exit();
return 0;
}

/* Restore device to its initial state */
static void __init smsc47m1_restore(const struct smsc47m1_sio_data *sio_data)
{
if ((sio_data->activate & 0x01) == 0) {
superio_enter();
superio_select();

pr_info(DRVNAME ": Disabling device\n");
superio_outb(SUPERIO_REG_ACT, sio_data->activate);

superio_exit();
}
}

#define CHECK 1
#define REQUEST 2
#define RELEASE 3
Expand Down Expand Up @@ -856,13 +878,15 @@ static int __init sm_smsc47m1_init(void)

exit_device:
platform_device_unregister(pdev);
smsc47m1_restore(&sio_data);
exit:
return err;
}

static void __exit sm_smsc47m1_exit(void)
{
platform_driver_unregister(&smsc47m1_driver);
smsc47m1_restore(pdev->dev.platform_data);
platform_device_unregister(pdev);
}

Expand Down

0 comments on commit d9d9d7d

Please sign in to comment.