* [PATCH] skeletonfb: Various corrections @ 2007-04-09 12:05 Antonino A. Daplas 2007-04-09 20:00 ` Andrew Morton 0 siblings, 1 reply; 6+ messages in thread From: Antonino A. Daplas @ 2007-04-09 12:05 UTC (permalink / raw) To: Andrew Morton; +Cc: Linux Fbdev development list, Krzysztof Halasa From: Krzysztof Helt <krzysztof.h1@wp.pl> This is mainly correction of types, typos and missing characters in the skeletonfb.c file found while trying to prepare a new fb driver. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Antonino Daplas <adaplas@gmail.com> --- drivers/video/skeletonfb.c | 118 ++++++++++++++++++++++++++------------------ 1 files changed, 71 insertions(+), 47 deletions(-) diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c index bb96cb6..30eb964 100644 --- a/drivers/video/skeletonfb.c +++ b/drivers/video/skeletonfb.c @@ -51,6 +51,9 @@ #include <linux/slab.h> #include <linux/delay.h> #include <linux/fb.h> #include <linux/init.h> +#ifdef CONFIG_PCI +#include <linux/pci.h> +#endif /* * This is just simple sample code. @@ -60,6 +63,11 @@ #include <linux/init.h> */ /* + * Driver data + */ +static char *mode_option __devinitdata = NULL; + +/* * If your driver supports multiple boards, you should make the * below data types arrays, or allocate them dynamically (using kmalloc()). */ @@ -278,7 +286,7 @@ static int xxxfb_set_par(struct fb_info */ static int xxxfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, - const struct fb_info *info) + struct fb_info *info) { if (regno >= 256) /* no. of hw registers */ return -EINVAL; @@ -416,7 +424,7 @@ #undef CNVT_TOHW * Returns negative errno on error, or zero on success. */ static int xxxfb_pan_display(struct fb_var_screeninfo *var, - const struct fb_info *info) + struct fb_info *info) { /* * If your hardware does not support panning, _do_ _not_ implement this @@ -454,7 +462,7 @@ static int xxxfb_pan_display(struct fb_v * Return !0 for any modes that are unimplemented. * */ -static int xxxfb_blank(int blank_mode, const struct fb_info *info) +static int xxxfb_blank(int blank_mode, struct fb_info *info) { /* ... */ return 0; @@ -483,7 +491,7 @@ static int xxxfb_blank(int blank_mode, c * depending on the rastering operation with the value of color which * is in the current color depth format. */ -void xxfb_fillrect(struct fb_info *p, const struct fb_fillrect *region) +void xxxfb_fillrect(struct fb_info *p, const struct fb_fillrect *region) { /* Meaning of struct fb_fillrect * @@ -647,21 +655,50 @@ void xxxfb_poll(struct fb_info *info, po * If the driver has implemented its own hardware-based drawing function, * implementing this function is highly recommended. */ -void xxxfb_sync(struct fb_info *info) +int xxxfb_sync(struct fb_info *info) { + return 0; } /* + * Frame buffer operations + */ + +static struct fb_ops xxxfb_ops = { + .owner = THIS_MODULE, + .fb_open = xxxfb_open, + .fb_read = xxxfb_read, + .fb_write = xxxfb_write, + .fb_release = xxxfb_release, + .fb_check_var = xxxfb_check_var, + .fb_set_par = xxxfb_set_par, + .fb_setcolreg = xxxfb_setcolreg, + .fb_blank = xxxfb_blank, + .fb_pan_display = xxxfb_pan_display, + .fb_fillrect = xxxfb_fillrect, /* Needed !!! */ + .fb_copyarea = xxxfb_copyarea, /* Needed !!! */ + .fb_imageblit = xxxfb_imageblit, /* Needed !!! */ + .fb_cursor = xxxfb_cursor, /* Optional !!! */ + .fb_rotate = xxxfb_rotate, + .fb_poll = xxxfb_poll, + .fb_sync = xxxfb_sync, + .fb_ioctl = xxxfb_ioctl, + .fb_mmap = xxxfb_mmap, +}; + +/* ------------------------------------------------------------------------- */ + + /* * Initialization */ /* static int __init xxfb_probe (struct device *device) -- for platform devs */ -static int __init xxxfb_probe(struct pci_dev *dev, +static int __devinit xxxfb_probe(struct pci_dev *dev, const_struct pci_device_id *ent) { struct fb_info *info; struct xxx_par *par; - struct device = &dev->dev; /* for pci drivers */ + struct device* device = &dev->dev; /* for pci drivers */ int cmap_len, retval; /* @@ -760,7 +797,7 @@ static int __init xxxfb_probe(struct pci * * NOTE: This field is currently unused. */ - info->pixmap.scan_align = 32 + info->pixmap.scan_align = 32; /***************************** End optional stage ***************************/ /* @@ -770,13 +807,13 @@ static int __init xxxfb_probe(struct pci if (!mode_option) mode_option = "640x480@60"; - retval = fb_find_mode(info->var, info, mode_option, NULL, 0, NULL, 8); + retval = fb_find_mode(&info->var, info, mode_option, NULL, 0, NULL, 8); if (!retval || retval == 4) return -EINVAL; /* This has to been done !!! */ - fb_alloc_cmap(info->cmap, cmap_len, 0); + fb_alloc_cmap(&info->cmap, cmap_len, 0); /* * The following is done in the case of having hardware with a static @@ -811,15 +848,15 @@ static int __init xxxfb_probe(struct pci /* * Cleanup */ -/* static void __exit xxxfb_remove(struct device *device) */ -static void __exit xxxfb_remove(struct pci_dev *dev) +/* static void __devexit xxxfb_remove(struct device *device) */ +static void __devexit xxxfb_remove(struct pci_dev *dev) { - struct fb_info *info = pci_get_drv_data(dev); - /* or dev_get_drv_data(device); */ + struct fb_info *info = pci_get_drvdata(dev); + /* or dev_get_drvdata(device); */ if (info) { unregister_framebuffer(info); - fb_dealloc_cmap(&info.cmap); + fb_dealloc_cmap(&info->cmap); /* ... */ framebuffer_release(info); } @@ -827,18 +864,25 @@ static void __exit xxxfb_remove(struct p return 0; } -#if CONFIG_PCI +#ifdef CONFIG_PCI +static struct pci_device_id xxxfb_id_table[] = { + { PCI_VENDOR_ID_XXX, PCI_DEVICE_ID_XXX, + PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, + ADDR, 0 }, + { 0, } +}; + /* For PCI drivers */ static struct pci_driver xxxfb_driver = { .name = "xxxfb", - .id_table = xxxfb_devices, + .id_table = xxxfb_id_table, .probe = xxxfb_probe, .remove = __devexit_p(xxxfb_remove), .suspend = xxxfb_suspend, /* optional */ .resume = xxxfb_resume, /* optional */ }; -static int __init xxxfb_init(void) +int __init xxxfb_init(void) { /* * For kernel boot options (in 'video=xxxfb:<options>' format) @@ -854,10 +898,12 @@ #endif return pci_register_driver(&xxxfb_driver); } +#ifdef MODULE static void __exit xxxfb_exit(void) { pci_unregister_driver(&xxxfb_driver); } +#endif #else #include <linux/platform_device.h> /* for platform devices */ @@ -898,13 +944,16 @@ #endif return ret; } +#ifdef MODULE static void __exit xxxfb_exit(void) { platform_device_unregister(&xxxfb_device); driver_unregister(&xxxfb_driver); } #endif +#endif +#ifdef MODULE /* * Setup */ @@ -917,34 +966,7 @@ int __init xxxfb_setup(char *options) { /* Parse user speficied options (`video=xxxfb:') */ } - -/* ------------------------------------------------------------------------- */ - - /* - * Frame buffer operations - */ - -static struct fb_ops xxxfb_ops = { - .owner = THIS_MODULE, - .fb_open = xxxfb_open, - .fb_read = xxxfb_read, - .fb_write = xxxfb_write, - .fb_release = xxxfb_release, - .fb_check_var = xxxfb_check_var, - .fb_set_par = xxxfb_set_par, - .fb_setcolreg = xxxfb_setcolreg, - .fb_blank = xxxfb_blank, - .fb_pan_display = xxxfb_pan_display, - .fb_fillrect = xxxfb_fillrect, /* Needed !!! */ - .fb_copyarea = xxxfb_copyarea, /* Needed !!! */ - .fb_imageblit = xxxfb_imageblit, /* Needed !!! */ - .fb_cursor = xxxfb_cursor, /* Optional !!! */ - .fb_rotate = xxxfb_rotate, - .fb_poll = xxxfb_poll, - .fb_sync = xxxfb_sync, - .fb_ioctl = xxxfb_ioctl, - .fb_mmap = xxxfb_mmap, -}; +#endif /* ------------------------------------------------------------------------- */ @@ -954,6 +976,8 @@ static struct fb_ops xxxfb_ops = { */ module_init(xxxfb_init); -module_exit(xxxfb_cleanup); +#ifdef MODULE +module_exit(xxxfb_remove); MODULE_LICENSE("GPL"); +#endif ------------------------------------------------------------------------- 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] skeletonfb: Various corrections 2007-04-09 12:05 [PATCH] skeletonfb: Various corrections Antonino A. Daplas @ 2007-04-09 20:00 ` Andrew Morton 2007-04-09 22:57 ` Antonino A. Daplas 2007-04-09 23:25 ` [PATCH] [RESEND] " Antonino A. Daplas 0 siblings, 2 replies; 6+ messages in thread From: Andrew Morton @ 2007-04-09 20:00 UTC (permalink / raw) To: Antonino A. Daplas Cc: Gerd Hoffmann, Linux Fbdev development list, Andi Kleen, Krzysztof Halasa On Mon, 09 Apr 2007 20:05:01 +0800 "Antonino A. Daplas" <adaplas@gmail.com> wrote: > From: Krzysztof Helt <krzysztof.h1@wp.pl> > > This is mainly correction of types, typos and missing characters > in the skeletonfb.c file found while trying to prepare a new fb > driver. > > Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> > Signed-off-by: Antonino Daplas <adaplas@gmail.com> > --- > > drivers/video/skeletonfb.c | 118 ++++++++++++++++++++++++++------------------ > 1 files changed, 71 insertions(+), 47 deletions(-) > > diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c > index bb96cb6..30eb964 100644 > --- a/drivers/video/skeletonfb.c > +++ b/drivers/video/skeletonfb.c > @@ -51,6 +51,9 @@ #include <linux/slab.h> > #include <linux/delay.h> > #include <linux/fb.h> > #include <linux/init.h> > +#ifdef CONFIG_PCI > +#include <linux/pci.h> > +#endif pci.h shouldn't need these include guards? > /* > * This is just simple sample code. > @@ -60,6 +63,11 @@ #include <linux/init.h> > */ > > /* > + * Driver data > + */ > +static char *mode_option __devinitdata = NULL; The initialisation to NULL is unneeded and undesirable (it increases vmlinux size). > > -#if CONFIG_PCI > +#ifdef CONFIG_PCI > +static struct pci_device_id xxxfb_id_table[] = { > + { PCI_VENDOR_ID_XXX, PCI_DEVICE_ID_XXX, > + PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, > + ADDR, 0 }, > + { 0, } > +}; > + > /* For PCI drivers */ > static struct pci_driver xxxfb_driver = { > .name = "xxxfb", > - .id_table = xxxfb_devices, > + .id_table = xxxfb_id_table, > .probe = xxxfb_probe, > .remove = __devexit_p(xxxfb_remove), > .suspend = xxxfb_suspend, /* optional */ > .resume = xxxfb_resume, /* optional */ > }; I think this example still need to handle the CONFIG_PM=n case? Something like #ifdef CONFIG_PM void xxxfb_suspend(args) { ... } #else #define xxxfb_suspend NULL #define xxxfb_resume NULL #endif > -static int __init xxxfb_init(void) > +int __init xxxfb_init(void) > { > /* > * For kernel boot options (in 'video=xxxfb:<options>' format) > @@ -854,10 +898,12 @@ #endif > return pci_register_driver(&xxxfb_driver); > } > > +#ifdef MODULE > static void __exit xxxfb_exit(void) > { > pci_unregister_driver(&xxxfb_driver); > } > +#endif > #else > #include <linux/platform_device.h> > /* for platform devices */ > @@ -898,13 +944,16 @@ #endif > return ret; > } > > +#ifdef MODULE > static void __exit xxxfb_exit(void) > { > platform_device_unregister(&xxxfb_device); > driver_unregister(&xxxfb_driver); > } > #endif > +#endif > Are these ifdefs around the __exit functions really recommended fbdev practice? I hope not. There are two types of exit code: __exit: discarded at boot time, via free_initmem() (except for uml, which does run exitcalls (or used to)). __exit_call: discarded at link time via /DISCARD/ in vmlinux.lds.S. So it is I think better to leave the __exit code in place so that the compiler gets to check it. It will increase vmlinux size, but that memory gets reclaimed at runtime. The __exit_call memory gets discarded at link-time, so I do think we should always compile __exit_call functions. (We don't actually _have_ any __exit_call functions in the kernel, which makes one wonder why we bothered creating it) ------------------------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] skeletonfb: Various corrections 2007-04-09 20:00 ` Andrew Morton @ 2007-04-09 22:57 ` Antonino A. Daplas 2007-04-09 23:25 ` [PATCH] [RESEND] " Antonino A. Daplas 1 sibling, 0 replies; 6+ messages in thread From: Antonino A. Daplas @ 2007-04-09 22:57 UTC (permalink / raw) To: Andrew Morton Cc: Gerd Hoffmann, Linux Fbdev development list, Andi Kleen, Krzysztof Halasa On Mon, 2007-04-09 at 13:00 -0700, Andrew Morton wrote: > On Mon, 09 Apr 2007 20:05:01 +0800 > "Antonino A. Daplas" <adaplas@gmail.com> wrote: > Note that skeletonfb doesn't even compile, but I'll do the corrections myself. > > From: Krzysztof Helt <krzysztof.h1@wp.pl> > > > > This is mainly correction of types, typos and missing characters > > in the skeletonfb.c file found while trying to prepare a new fb > > driver. > > > > Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> > > Signed-off-by: Antonino Daplas <adaplas@gmail.com> > > --- > > > > drivers/video/skeletonfb.c | 118 ++++++++++++++++++++++++++------------------ > > 1 files changed, 71 insertions(+), 47 deletions(-) > > > > diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c > > index bb96cb6..30eb964 100644 > > --- a/drivers/video/skeletonfb.c > > +++ b/drivers/video/skeletonfb.c > > @@ -51,6 +51,9 @@ #include <linux/slab.h> > > #include <linux/delay.h> > > #include <linux/fb.h> > > #include <linux/init.h> > > +#ifdef CONFIG_PCI > > +#include <linux/pci.h> > > +#endif > > pci.h shouldn't need these include guards? > > > /* > > * This is just simple sample code. > > @@ -60,6 +63,11 @@ #include <linux/init.h> > > */ > > > > /* > > + * Driver data > > + */ > > +static char *mode_option __devinitdata = NULL; > > The initialisation to NULL is unneeded and undesirable (it increases > vmlinux size). > > > > > -#if CONFIG_PCI > > +#ifdef CONFIG_PCI > > +static struct pci_device_id xxxfb_id_table[] = { > > + { PCI_VENDOR_ID_XXX, PCI_DEVICE_ID_XXX, > > + PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, > > + ADDR, 0 }, > > + { 0, } > > +}; > > + > > /* For PCI drivers */ > > static struct pci_driver xxxfb_driver = { > > .name = "xxxfb", > > - .id_table = xxxfb_devices, > > + .id_table = xxxfb_id_table, > > .probe = xxxfb_probe, > > .remove = __devexit_p(xxxfb_remove), > > .suspend = xxxfb_suspend, /* optional */ > > .resume = xxxfb_resume, /* optional */ > > }; > > I think this example still need to handle the CONFIG_PM=n case? > > Something like > > #ifdef CONFIG_PM > void xxxfb_suspend(args) > { > ... > } > #else > #define xxxfb_suspend NULL > #define xxxfb_resume NULL > #endif > > > > -static int __init xxxfb_init(void) > > +int __init xxxfb_init(void) > > { > > /* > > * For kernel boot options (in 'video=xxxfb:<options>' format) > > @@ -854,10 +898,12 @@ #endif > > return pci_register_driver(&xxxfb_driver); > > } > > > > +#ifdef MODULE > > static void __exit xxxfb_exit(void) > > { > > pci_unregister_driver(&xxxfb_driver); > > } > > +#endif > > #else > > #include <linux/platform_device.h> > > /* for platform devices */ > > @@ -898,13 +944,16 @@ #endif > > return ret; > > } > > > > +#ifdef MODULE > > static void __exit xxxfb_exit(void) > > { > > platform_device_unregister(&xxxfb_device); > > driver_unregister(&xxxfb_driver); > > } > > #endif > > +#endif > > > > Are these ifdefs around the __exit functions really recommended fbdev > practice? I hope not. There is no recommendation, but it has been done like this since the early days, I don't know the exact reason, but probably to minimize code size? Tony ------------------------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] [RESEND] skeletonfb: Various corrections 2007-04-09 20:00 ` Andrew Morton 2007-04-09 22:57 ` Antonino A. Daplas @ 2007-04-09 23:25 ` Antonino A. Daplas 2007-04-10 12:37 ` Krzysztof Halasa 1 sibling, 1 reply; 6+ messages in thread From: Antonino A. Daplas @ 2007-04-09 23:25 UTC (permalink / raw) To: Andrew Morton Cc: Gerd Hoffmann, Linux Fbdev development list, Andi Kleen, Krzysztof Halasa From: Krzysztof Helt <krzysztof.h1@wp.pl> This is mainly correction of types, typos and missing characters in the skeletonfb.c file found while trying to prepare a new fb driver. [adaplas] Additions on power management and fixes as per akpm Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Antonino Daplas <adaplas@gmail.com> --- drivers/video/skeletonfb.c | 195 ++++++++++++++++++++++++++++++++------------ 1 files changed, 142 insertions(+), 53 deletions(-) diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c index bb96cb6..9fda5b5 100644 --- a/drivers/video/skeletonfb.c +++ b/drivers/video/skeletonfb.c @@ -51,6 +51,7 @@ #include <linux/slab.h> #include <linux/delay.h> #include <linux/fb.h> #include <linux/init.h> +#include <linux/pci.h> /* * This is just simple sample code. @@ -60,6 +61,11 @@ #include <linux/init.h> */ /* + * Driver data + */ +static char *mode_option __devinitdata; + +/* * If your driver supports multiple boards, you should make the * below data types arrays, or allocate them dynamically (using kmalloc()). */ @@ -278,7 +284,7 @@ static int xxxfb_set_par(struct fb_info */ static int xxxfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, - const struct fb_info *info) + struct fb_info *info) { if (regno >= 256) /* no. of hw registers */ return -EINVAL; @@ -416,7 +422,7 @@ #undef CNVT_TOHW * Returns negative errno on error, or zero on success. */ static int xxxfb_pan_display(struct fb_var_screeninfo *var, - const struct fb_info *info) + struct fb_info *info) { /* * If your hardware does not support panning, _do_ _not_ implement this @@ -454,7 +460,7 @@ static int xxxfb_pan_display(struct fb_v * Return !0 for any modes that are unimplemented. * */ -static int xxxfb_blank(int blank_mode, const struct fb_info *info) +static int xxxfb_blank(int blank_mode, struct fb_info *info) { /* ... */ return 0; @@ -483,7 +489,7 @@ static int xxxfb_blank(int blank_mode, c * depending on the rastering operation with the value of color which * is in the current color depth format. */ -void xxfb_fillrect(struct fb_info *p, const struct fb_fillrect *region) +void xxxfb_fillrect(struct fb_info *p, const struct fb_fillrect *region) { /* Meaning of struct fb_fillrect * @@ -647,21 +653,50 @@ void xxxfb_poll(struct fb_info *info, po * If the driver has implemented its own hardware-based drawing function, * implementing this function is highly recommended. */ -void xxxfb_sync(struct fb_info *info) +int xxxfb_sync(struct fb_info *info) { + return 0; } /* + * Frame buffer operations + */ + +static struct fb_ops xxxfb_ops = { + .owner = THIS_MODULE, + .fb_open = xxxfb_open, + .fb_read = xxxfb_read, + .fb_write = xxxfb_write, + .fb_release = xxxfb_release, + .fb_check_var = xxxfb_check_var, + .fb_set_par = xxxfb_set_par, + .fb_setcolreg = xxxfb_setcolreg, + .fb_blank = xxxfb_blank, + .fb_pan_display = xxxfb_pan_display, + .fb_fillrect = xxxfb_fillrect, /* Needed !!! */ + .fb_copyarea = xxxfb_copyarea, /* Needed !!! */ + .fb_imageblit = xxxfb_imageblit, /* Needed !!! */ + .fb_cursor = xxxfb_cursor, /* Optional !!! */ + .fb_rotate = xxxfb_rotate, + .fb_poll = xxxfb_poll, + .fb_sync = xxxfb_sync, + .fb_ioctl = xxxfb_ioctl, + .fb_mmap = xxxfb_mmap, +}; + +/* ------------------------------------------------------------------------- */ + + /* * Initialization */ /* static int __init xxfb_probe (struct device *device) -- for platform devs */ -static int __init xxxfb_probe(struct pci_dev *dev, +static int __devinit xxxfb_probe(struct pci_dev *dev, const_struct pci_device_id *ent) { struct fb_info *info; struct xxx_par *par; - struct device = &dev->dev; /* for pci drivers */ + struct device* device = &dev->dev; /* for pci drivers */ int cmap_len, retval; /* @@ -760,7 +795,7 @@ static int __init xxxfb_probe(struct pci * * NOTE: This field is currently unused. */ - info->pixmap.scan_align = 32 + info->pixmap.scan_align = 32; /***************************** End optional stage ***************************/ /* @@ -770,13 +805,13 @@ static int __init xxxfb_probe(struct pci if (!mode_option) mode_option = "640x480@60"; - retval = fb_find_mode(info->var, info, mode_option, NULL, 0, NULL, 8); + retval = fb_find_mode(&info->var, info, mode_option, NULL, 0, NULL, 8); if (!retval || retval == 4) return -EINVAL; /* This has to been done !!! */ - fb_alloc_cmap(info->cmap, cmap_len, 0); + fb_alloc_cmap(&info->cmap, cmap_len, 0); /* * The following is done in the case of having hardware with a static @@ -811,15 +846,15 @@ static int __init xxxfb_probe(struct pci /* * Cleanup */ -/* static void __exit xxxfb_remove(struct device *device) */ -static void __exit xxxfb_remove(struct pci_dev *dev) +/* static void __devexit xxxfb_remove(struct device *device) */ +static void __devexit xxxfb_remove(struct pci_dev *dev) { - struct fb_info *info = pci_get_drv_data(dev); - /* or dev_get_drv_data(device); */ + struct fb_info *info = pci_get_drvdata(dev); + /* or dev_get_drvdata(device); */ if (info) { unregister_framebuffer(info); - fb_dealloc_cmap(&info.cmap); + fb_dealloc_cmap(&info->cmap); /* ... */ framebuffer_release(info); } @@ -827,18 +862,61 @@ static void __exit xxxfb_remove(struct p return 0; } -#if CONFIG_PCI +#ifdef CONFIG_PCI +#ifdef CONFIG_PM +/** + * xxxfb_suspend - Optional but recommended function. Suspend the device. + * @dev: PCI device + * @msg: the suspend event code. + * + * See Documentation/power/devices.txt for more information + */ +static int xxxfb_suspend(struct pci_dev *dev, pm_message_t msg) +{ + struct fb_info *info = pci_get_drvdata(dev); + struct xxxfb_par *par = info->par; + + /* suspend here */ + return 0; +} + +/** + * xxxfb_resume - Optional but recommended function. Resume the device. + * @dev: PCI device + * + * See Documentation/power/devices.txt for more information + */ +static int xxxfb_resume(struct pci_dev *dev) +{ + struct fb_info *info = pci_get_drvdata(dev); + struct xxxfb_par *par = info->par; + + /* resume here */ + return 0; +} +#else +#define xxxfb_suspend NULL +#define xxxfb_resume NULL +#endif /* CONFIG_PM */ + +static struct pci_device_id xxxfb_id_table[] = { + { PCI_VENDOR_ID_XXX, PCI_DEVICE_ID_XXX, + PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, + ADDR, 0 }, + { 0, } +}; + /* For PCI drivers */ static struct pci_driver xxxfb_driver = { .name = "xxxfb", - .id_table = xxxfb_devices, + .id_table = xxxfb_id_table, .probe = xxxfb_probe, .remove = __devexit_p(xxxfb_remove), - .suspend = xxxfb_suspend, /* optional */ - .resume = xxxfb_resume, /* optional */ + .suspend = xxxfb_suspend, /* optional but recommended */ + .resume = xxxfb_resume, /* optional but recommended */ }; -static int __init xxxfb_init(void) +int __init xxxfb_init(void) { /* * For kernel boot options (in 'video=xxxfb:<options>' format) @@ -858,16 +936,53 @@ static void __exit xxxfb_exit(void) { pci_unregister_driver(&xxxfb_driver); } -#else +#else /* non PCI, platform drivers */ #include <linux/platform_device.h> /* for platform devices */ + +#ifdef CONFIG_PM +/** + * xxxfb_suspend - Optional but recommended function. Suspend the device. + * @dev: platform device + * @msg: the suspend event code. + * + * See Documentation/power/devices.txt for more information + */ +static int xxxfb_suspend(struct platform_device *dev, pm_message_t msg) +{ + struct fb_info *info = platform_get_drvdata(dev); + struct xxxfb_par *par = info->par; + + /* suspend here */ + return 0; +} + +/** + * xxxfb_resume - Optional but recommended function. Resume the device. + * @dev: PCI device + * + * See Documentation/power/devices.txt for more information + */ +static int xxxfb_suspend(struct platform_dev *dev) +{ + struct fb_info *info = platform_get_drvdata(dev); + struct xxxfb_par *par = info->par; + + /* resume here */ + return 0; +} +#else +#define xxxfb_suspend NULL +#define xxxfb_resume NULL +#endif /* CONFIG_PM */ + static struct device_driver xxxfb_driver = { .name = "xxxfb", .bus = &platform_bus_type, .probe = xxxfb_probe, .remove = xxxfb_remove, - .suspend = xxxfb_suspend, /* optional */ - .resume = xxxfb_resume, /* optional */ + .suspend = xxxfb_suspend, /* optional but recommended */ + .resume = xxxfb_resume, /* optional but recommended */ }; static struct platform_device xxxfb_device = { @@ -903,8 +1018,9 @@ static void __exit xxxfb_exit(void) platform_device_unregister(&xxxfb_device); driver_unregister(&xxxfb_driver); } -#endif +#endif /* CONFIG_PCI */ +#ifdef MODULE /* * Setup */ @@ -917,34 +1033,7 @@ int __init xxxfb_setup(char *options) { /* Parse user speficied options (`video=xxxfb:') */ } - -/* ------------------------------------------------------------------------- */ - - /* - * Frame buffer operations - */ - -static struct fb_ops xxxfb_ops = { - .owner = THIS_MODULE, - .fb_open = xxxfb_open, - .fb_read = xxxfb_read, - .fb_write = xxxfb_write, - .fb_release = xxxfb_release, - .fb_check_var = xxxfb_check_var, - .fb_set_par = xxxfb_set_par, - .fb_setcolreg = xxxfb_setcolreg, - .fb_blank = xxxfb_blank, - .fb_pan_display = xxxfb_pan_display, - .fb_fillrect = xxxfb_fillrect, /* Needed !!! */ - .fb_copyarea = xxxfb_copyarea, /* Needed !!! */ - .fb_imageblit = xxxfb_imageblit, /* Needed !!! */ - .fb_cursor = xxxfb_cursor, /* Optional !!! */ - .fb_rotate = xxxfb_rotate, - .fb_poll = xxxfb_poll, - .fb_sync = xxxfb_sync, - .fb_ioctl = xxxfb_ioctl, - .fb_mmap = xxxfb_mmap, -}; +#endif /* MODULE *? /* ------------------------------------------------------------------------- */ @@ -954,6 +1043,6 @@ static struct fb_ops xxxfb_ops = { */ module_init(xxxfb_init); -module_exit(xxxfb_cleanup); +module_exit(xxxfb_remove); MODULE_LICENSE("GPL"); ------------------------------------------------------------------------- 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] [RESEND] skeletonfb: Various corrections 2007-04-09 23:25 ` [PATCH] [RESEND] " Antonino A. Daplas @ 2007-04-10 12:37 ` Krzysztof Halasa 2007-04-10 13:25 ` Antonino A. Daplas 0 siblings, 1 reply; 6+ messages in thread From: Krzysztof Halasa @ 2007-04-10 12:37 UTC (permalink / raw) To: Antonino A. Daplas Cc: Gerd Hoffmann, Andrew Morton, Linux Fbdev development list, Andi Kleen BTW: perhaps you wanted to Cc: the author and not me? :-) > Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> ^^^^^^^^^^^^^^^^^^^^^^^^ -- Krzysztof Halasa ------------------------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [RESEND] skeletonfb: Various corrections 2007-04-10 12:37 ` Krzysztof Halasa @ 2007-04-10 13:25 ` Antonino A. Daplas 0 siblings, 0 replies; 6+ messages in thread From: Antonino A. Daplas @ 2007-04-10 13:25 UTC (permalink / raw) To: Krzysztof Halasa Cc: Gerd Hoffmann, Andrew Morton, Linux Fbdev development list, Andi Kleen On Tue, 2007-04-10 at 14:37 +0200, Krzysztof Halasa wrote: > BTW: perhaps you wanted to Cc: the author and not me? :-) > > > Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> > ^^^^^^^^^^^^^^^^^^^^^^^^ Sorry about that :-), the author did get an email though. Tony ------------------------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-04-10 13:25 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-04-09 12:05 [PATCH] skeletonfb: Various corrections Antonino A. Daplas 2007-04-09 20:00 ` Andrew Morton 2007-04-09 22:57 ` Antonino A. Daplas 2007-04-09 23:25 ` [PATCH] [RESEND] " Antonino A. Daplas 2007-04-10 12:37 ` Krzysztof Halasa 2007-04-10 13:25 ` Antonino A. Daplas
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).