Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105689
b: refs/heads/master
c: 96776f3
h: refs/heads/master
i:
  105687: ba914de
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jul 24, 2008
1 parent 45d9247 commit f092daf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 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: 1d76d9dc448d5a6fc7b49ba06c634aa6927bcc3d
refs/heads/master: 96776f3b57eb7beb889a4368937cc9d74082a47e
39 changes: 19 additions & 20 deletions trunk/drivers/ide/pci/sc1200.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,10 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
* we only save state when going from full power to less
*/
if (state.event == PM_EVENT_ON) {
struct sc1200_saved_state *ss;
struct ide_host *host = pci_get_drvdata(dev);
struct sc1200_saved_state *ss = host->host_priv;
unsigned int r;

/*
* allocate a permanent save area, if not already allocated
*/
ss = (struct sc1200_saved_state *)pci_get_drvdata(dev);
if (ss == NULL) {
ss = kmalloc(sizeof(*ss), GFP_KERNEL);
if (ss == NULL)
return -ENOMEM;
pci_set_drvdata(dev, ss);
}

/*
* save timing registers
* (this may be unnecessary if BIOS also does it)
Expand All @@ -263,24 +253,21 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)

static int sc1200_resume (struct pci_dev *dev)
{
struct sc1200_saved_state *ss;
struct ide_host *host = pci_get_drvdata(dev);
struct sc1200_saved_state *ss = host->host_priv;
unsigned int r;
int i;

i = pci_enable_device(dev);
if (i)
return i;

ss = (struct sc1200_saved_state *)pci_get_drvdata(dev);

/*
* restore timing registers
* (this may be unnecessary if BIOS also does it)
*/
if (ss) {
for (r = 0; r < 8; r++)
pci_write_config_dword(dev, 0x40 + r * 4, ss->regs[r]);
}
for (r = 0; r < 8; r++)
pci_write_config_dword(dev, 0x40 + r * 4, ss->regs[r]);

return 0;
}
Expand Down Expand Up @@ -317,7 +304,19 @@ static const struct ide_port_info sc1200_chipset __devinitdata = {

static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
return ide_pci_init_one(dev, &sc1200_chipset, NULL);
struct sc1200_saved_state *ss = NULL;
int rc;

#ifdef CONFIG_PM
ss = kmalloc(sizeof(*ss), GFP_KERNEL);
if (ss == NULL)
return -ENOMEM;
#endif
rc = ide_pci_init_one(dev, &sc1200_chipset, ss);
if (rc)
kfree(ss);

return rc;
}

static const struct pci_device_id sc1200_pci_tbl[] = {
Expand Down

0 comments on commit f092daf

Please sign in to comment.