2 * fbsysfs.c - framebuffer device class and attributes
4 * Copyright (c) 2004 James Simmons <jsimmons@infradead.org>
6 * This program is free software you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
13 * Note: currently there's only stubs for framebuffer_alloc and
14 * framebuffer_release here. The reson for that is that until all drivers
15 * are converted to use it a sysfsification will open OOPSable races.
18 #include <linux/kernel.h>
22 * framebuffer_alloc - creates a new frame buffer info structure
24 * @size: size of driver private data, can be zero
25 * @dev: pointer to the device for this fb, this can be NULL
27 * Creates a new frame buffer info structure. Also reserves @size bytes
28 * for driver private data (info->par). info->par (if any) will be
29 * aligned to sizeof(long).
31 * Returns the new structure, or NULL if an error occured.
34 struct fb_info
*framebuffer_alloc(size_t size
, struct device
*dev
)
36 #define BYTES_PER_LONG (BITS_PER_LONG/8)
37 #define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG))
38 int fb_info_size
= sizeof(struct fb_info
);
43 fb_info_size
+= PADDING
;
45 p
= kmalloc(fb_info_size
+ size
, GFP_KERNEL
);
48 memset(p
, 0, fb_info_size
+ size
);
49 info
= (struct fb_info
*) p
;
52 info
->par
= p
+ fb_info_size
;
60 * framebuffer_release - marks the structure available for freeing
62 * @info: frame buffer info structure
64 * Drop the reference count of the class_device embedded in the
65 * framebuffer info structure.
68 void framebuffer_release(struct fb_info
*info
)
73 EXPORT_SYMBOL(framebuffer_release
);
74 EXPORT_SYMBOL(framebuffer_alloc
);