Hi, On Monday, 18 December 2006 21:50, Stefan Seyfried wrote: > Hi, > > (i'll discuss this on suspend-devel, we can take the rest back into cc: once > the coding issues are solved :-) > > On Mon, Dec 18, 2006 at 09:00:41PM +0100, Rafael J. Wysocki wrote: > > > > Index: s2ram.c > > > =================================================================== > > > RCS file: /cvsroot/suspend/suspend/s2ram.c,v > > > retrieving revision 1.45 > > > diff -u -p -r1.45 s2ram.c > > > --- s2ram.c 20 Sep 2006 16:23:51 -0000 1.45 > > > +++ s2ram.c 18 Dec 2006 16:44:47 -0000 > > > @@ -11,12 +11,16 @@ > > > #include <errno.h> > > > #include <string.h> > > > > > > +#include <pci/pci.h> > > > + > > > #define S2RAM > > > #include "vbetool/vbetool.h" > > > #include "vt.h" > > > #include "s2ram.h" > > > > > > static void *vbe_buffer; > > > +unsigned char vga_pci_state[256]; > > > +struct pci_dev vga_dev; > > > > @@ -143,6 +149,35 @@ int s2ram_check(int id) > > > return ret; > > > } > > > > > > +struct pci_dev find_vga(void) > > > +{ > > > + struct pci_access *pacc; > > > + struct pci_dev *dev; > > > + > > > + pacc = pci_alloc(); /* Get the pci_access structure */ > > > + pci_init(pacc); /* Initialize the PCI library */ > > > + pci_scan_bus(pacc); /* We want to get the list of devices */ > > > + > > > + for (dev=pacc->devices; dev; dev=dev->next) { > > > + pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_CLASS); > > > + if (dev->device_class == 0x300) > > > + break; > > > + } > > > + pci_cleanup(pacc); > > > + > > > + return *dev; > > > +} > > > > Hm, I'd rather return the pointer (eg. so that the structure can be freed). > > Ok (hopefully :-)
Now it looks much better to me, but I'd actually free the pci_dev object when it's no longer necessary. And I have a question: is it possible that we don't find a VGA device? And if so, then what are we going to do? Greetings, Rafael -- If you don't have the time to read, you don't have the time or the tools to write. - Stephen King ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel