aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttvp.h
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-01-28 19:32:59 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:47 -0400
commit4b10d3b626922ffa2387905a230b12450281a12d (patch)
treed65429e98adf29ba08b6ddbf09e6ac78fcaaeac3 /drivers/media/video/bt8xx/bttvp.h
parent6f98700a5bb8d218162b04db1b8a3921a0dcc7ce (diff)
V4L/DVB (10568): bttv: dynamically allocate device data
The bttv driver had static array of structures for up to 16 possible bttv devices, even though few users have more than one or two. The structures were quite large and this resulted in a huge BSS segment. Change the driver to allocate the bttv device data dynamically, which changes "struct bttv bttvs[BTTV_MAX]" to "struct bttv *bttvs[BTTV_MAX]". It would be nice to get ride of "bttvs" entirely but there are some complications with gpio access from the audio & mpeg drivers. To help bttvs removal along anyway, I changed the open() methods use the video device's drvdata to get the driver data instead of looking it up in the bttvs array. This is also more efficient. Some WARN_ON()s are added in cases the device node exists by the bttv device doesn't, which I don't think should be possible. The gpio access functions need to check if bttvs[card] is NULL now. Though calling them on a non-existent card in the first place is wrong, but hard to solve given the fundamental problems in how the gpio access code works. This patch reduces the bss size by 66560 bytes on ia32. Overall change is a reduction of 66398 bytes, as the WARN_ON()s add some 198 bytes. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bt8xx/bttvp.h')
-rw-r--r--drivers/media/video/bt8xx/bttvp.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h
index 497c8dcb4ae8..b8274d233fd0 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -462,7 +462,7 @@ struct bttv {
462/* our devices */ 462/* our devices */
463#define BTTV_MAX 32 463#define BTTV_MAX 32
464extern unsigned int bttv_num; 464extern unsigned int bttv_num;
465extern struct bttv bttvs[BTTV_MAX]; 465extern struct bttv *bttvs[BTTV_MAX];
466 466
467static inline unsigned int bttv_muxsel(const struct bttv *btv, 467static inline unsigned int bttv_muxsel(const struct bttv *btv,
468 unsigned int input) 468 unsigned int input)