diff options
author | Adrian Bunk <bunk@kernel.org> | 2007-11-05 12:07:20 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:02:05 -0500 |
commit | 39e75cfedf5b40116136894241ca1182089f3637 (patch) | |
tree | df93853015af306d3215b64a2420470178879157 /drivers/media/video/cx23885/cx23885-core.c | |
parent | 9695a49839353bdaff79fe27399be2eb72585223 (diff) |
V4L/DVB (6575): cx23885/: cleanups
This patch contains the following cleanups:
- make the following needlessly global code static:
- cx23885-core.c: struct cx23885_sram_channels[]
- cx23885-core.c: struct cx23887_sram_channels[]
- cx23885-core.c: cx23885_wakeup()
- cx23885-core.c: cx23885_sram_channel_setup()
- cx23885-core.c: cx23885_sram_channel_dump()
- cx23885-core.c: cx23885_risc_disasm()
- cx23885-core.c: cx23885_shutdown()
- cx23885-core.c: cx23885_reset()
- cx23885-core.c: cx23885_dev_unregister()
- cx23885-core.c: cx23885_risc_databuffer()
- cx23885-core.c: cx23885_risc_stopper()
- #if 0 the following unused functions:
- cx23885-core.c: cx23885_risc_buffer()
- cx23885-core.c: cx23885_cancel_buffers()
- remove the following unused EXPORT_SYMBOL's:
- cx23885-cards.c: cx23885_boards
- cx23885-i2c.c: cx23885_call_i2c_clients
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Reviewed-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx23885/cx23885-core.c')
-rw-r--r-- | drivers/media/video/cx23885/cx23885-core.c | 95 |
1 files changed, 23 insertions, 72 deletions
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index 3cdd136477e5..0c9c9af0efb7 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c | |||
@@ -73,7 +73,7 @@ static LIST_HEAD(cx23885_devlist); | |||
73 | * 0x00010ea0 0x00010xxx Free | 73 | * 0x00010ea0 0x00010xxx Free |
74 | */ | 74 | */ |
75 | 75 | ||
76 | struct sram_channel cx23885_sram_channels[] = { | 76 | static struct sram_channel cx23885_sram_channels[] = { |
77 | [SRAM_CH01] = { | 77 | [SRAM_CH01] = { |
78 | .name = "test ch1", | 78 | .name = "test ch1", |
79 | .cmds_start = 0x10000, | 79 | .cmds_start = 0x10000, |
@@ -205,7 +205,7 @@ struct sram_channel cx23885_sram_channels[] = { | |||
205 | * 0x00010ea0 0x00010xxx Free | 205 | * 0x00010ea0 0x00010xxx Free |
206 | */ | 206 | */ |
207 | 207 | ||
208 | struct sram_channel cx23887_sram_channels[] = { | 208 | static struct sram_channel cx23887_sram_channels[] = { |
209 | [SRAM_CH01] = { | 209 | [SRAM_CH01] = { |
210 | .name = "test ch1", | 210 | .name = "test ch1", |
211 | .cmds_start = 0x0, | 211 | .cmds_start = 0x0, |
@@ -356,8 +356,8 @@ static int cx23885_risc_decode(u32 risc) | |||
356 | return incr[risc >> 28] ? incr[risc >> 28] : 1; | 356 | return incr[risc >> 28] ? incr[risc >> 28] : 1; |
357 | } | 357 | } |
358 | 358 | ||
359 | void cx23885_wakeup(struct cx23885_tsport *port, | 359 | static void cx23885_wakeup(struct cx23885_tsport *port, |
360 | struct cx23885_dmaqueue *q, u32 count) | 360 | struct cx23885_dmaqueue *q, u32 count) |
361 | { | 361 | { |
362 | struct cx23885_dev *dev = port->dev; | 362 | struct cx23885_dev *dev = port->dev; |
363 | struct cx23885_buffer *buf; | 363 | struct cx23885_buffer *buf; |
@@ -391,12 +391,10 @@ void cx23885_wakeup(struct cx23885_tsport *port, | |||
391 | printk("%s: %d buffers handled (should be 1)\n", | 391 | printk("%s: %d buffers handled (should be 1)\n", |
392 | __FUNCTION__, bc); | 392 | __FUNCTION__, bc); |
393 | } | 393 | } |
394 | void cx23885_sram_channel_dump(struct cx23885_dev *dev, | ||
395 | struct sram_channel *ch); | ||
396 | 394 | ||
397 | int cx23885_sram_channel_setup(struct cx23885_dev *dev, | 395 | static int cx23885_sram_channel_setup(struct cx23885_dev *dev, |
398 | struct sram_channel *ch, | 396 | struct sram_channel *ch, |
399 | unsigned int bpl, u32 risc) | 397 | unsigned int bpl, u32 risc) |
400 | { | 398 | { |
401 | unsigned int i, lines; | 399 | unsigned int i, lines; |
402 | u32 cdt; | 400 | u32 cdt; |
@@ -467,8 +465,8 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev, | |||
467 | return 0; | 465 | return 0; |
468 | } | 466 | } |
469 | 467 | ||
470 | void cx23885_sram_channel_dump(struct cx23885_dev *dev, | 468 | static void cx23885_sram_channel_dump(struct cx23885_dev *dev, |
471 | struct sram_channel *ch) | 469 | struct sram_channel *ch) |
472 | { | 470 | { |
473 | static char *name[] = { | 471 | static char *name[] = { |
474 | "init risc lo", | 472 | "init risc lo", |
@@ -529,8 +527,8 @@ void cx23885_sram_channel_dump(struct cx23885_dev *dev, | |||
529 | dev->name, cx_read(ch->cnt2_reg)); | 527 | dev->name, cx_read(ch->cnt2_reg)); |
530 | } | 528 | } |
531 | 529 | ||
532 | void cx23885_risc_disasm(struct cx23885_tsport *port, | 530 | static void cx23885_risc_disasm(struct cx23885_tsport *port, |
533 | struct btcx_riscmem *risc) | 531 | struct btcx_riscmem *risc) |
534 | { | 532 | { |
535 | struct cx23885_dev *dev = port->dev; | 533 | struct cx23885_dev *dev = port->dev; |
536 | unsigned int i, j, n; | 534 | unsigned int i, j, n; |
@@ -548,7 +546,7 @@ void cx23885_risc_disasm(struct cx23885_tsport *port, | |||
548 | } | 546 | } |
549 | } | 547 | } |
550 | 548 | ||
551 | void cx23885_shutdown(struct cx23885_dev *dev) | 549 | static void cx23885_shutdown(struct cx23885_dev *dev) |
552 | { | 550 | { |
553 | /* disable RISC controller */ | 551 | /* disable RISC controller */ |
554 | cx_write(DEV_CNTRL2, 0); | 552 | cx_write(DEV_CNTRL2, 0); |
@@ -578,7 +576,7 @@ void cx23885_shutdown(struct cx23885_dev *dev) | |||
578 | 576 | ||
579 | } | 577 | } |
580 | 578 | ||
581 | void cx23885_reset(struct cx23885_dev *dev) | 579 | static void cx23885_reset(struct cx23885_dev *dev) |
582 | { | 580 | { |
583 | dprintk(1, "%s()\n", __FUNCTION__); | 581 | dprintk(1, "%s()\n", __FUNCTION__); |
584 | 582 | ||
@@ -636,8 +634,8 @@ static int get_resources(struct cx23885_dev *dev) | |||
636 | } | 634 | } |
637 | 635 | ||
638 | static void cx23885_timeout(unsigned long data); | 636 | static void cx23885_timeout(unsigned long data); |
639 | int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | 637 | static int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, |
640 | u32 reg, u32 mask, u32 value); | 638 | u32 reg, u32 mask, u32 value); |
641 | 639 | ||
642 | static int cx23885_init_tsport(struct cx23885_dev *dev, struct cx23885_tsport *port, int portno) | 640 | static int cx23885_init_tsport(struct cx23885_dev *dev, struct cx23885_tsport *port, int portno) |
643 | { | 641 | { |
@@ -837,7 +835,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
837 | return 0; | 835 | return 0; |
838 | } | 836 | } |
839 | 837 | ||
840 | void cx23885_dev_unregister(struct cx23885_dev *dev) | 838 | static void cx23885_dev_unregister(struct cx23885_dev *dev) |
841 | { | 839 | { |
842 | release_mem_region(pci_resource_start(dev->pci,0), | 840 | release_mem_region(pci_resource_start(dev->pci,0), |
843 | pci_resource_len(dev->pci,0)); | 841 | pci_resource_len(dev->pci,0)); |
@@ -912,49 +910,12 @@ static u32* cx23885_risc_field(u32 *rp, struct scatterlist *sglist, | |||
912 | return rp; | 910 | return rp; |
913 | } | 911 | } |
914 | 912 | ||
915 | int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | ||
916 | struct scatterlist *sglist, unsigned int top_offset, | ||
917 | unsigned int bottom_offset, unsigned int bpl, | ||
918 | unsigned int padding, unsigned int lines) | ||
919 | { | ||
920 | u32 instructions, fields; | ||
921 | u32 *rp; | ||
922 | int rc; | ||
923 | |||
924 | fields = 0; | ||
925 | if (UNSET != top_offset) | ||
926 | fields++; | ||
927 | if (UNSET != bottom_offset) | ||
928 | fields++; | ||
929 | |||
930 | /* estimate risc mem: worst case is one write per page border + | ||
931 | one write per scan line + syncs + jump (all 2 dwords). Padding | ||
932 | can cause next bpl to start close to a page border. First DMA | ||
933 | region may be smaller than PAGE_SIZE */ | ||
934 | /* write and jump need and extra dword */ | ||
935 | instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines); | ||
936 | instructions += 2; | ||
937 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*12)) < 0) | ||
938 | return rc; | ||
939 | |||
940 | /* write risc instructions */ | ||
941 | rp = risc->cpu; | ||
942 | if (UNSET != top_offset) | ||
943 | rp = cx23885_risc_field(rp, sglist, top_offset, 0, | ||
944 | bpl, padding, lines); | ||
945 | if (UNSET != bottom_offset) | ||
946 | rp = cx23885_risc_field(rp, sglist, bottom_offset, 0x200, | ||
947 | bpl, padding, lines); | ||
948 | |||
949 | /* save pointer to jmp instruction address */ | ||
950 | risc->jmp = rp; | ||
951 | BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size); | ||
952 | return 0; | ||
953 | } | ||
954 | 913 | ||
955 | int cx23885_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc, | 914 | static int cx23885_risc_databuffer(struct pci_dev *pci, |
956 | struct scatterlist *sglist, unsigned int bpl, | 915 | struct btcx_riscmem *risc, |
957 | unsigned int lines) | 916 | struct scatterlist *sglist, |
917 | unsigned int bpl, | ||
918 | unsigned int lines) | ||
958 | { | 919 | { |
959 | u32 instructions; | 920 | u32 instructions; |
960 | u32 *rp; | 921 | u32 *rp; |
@@ -981,8 +942,8 @@ int cx23885_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
981 | return 0; | 942 | return 0; |
982 | } | 943 | } |
983 | 944 | ||
984 | int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | 945 | static int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, |
985 | u32 reg, u32 mask, u32 value) | 946 | u32 reg, u32 mask, u32 value) |
986 | { | 947 | { |
987 | u32 *rp; | 948 | u32 *rp; |
988 | int rc; | 949 | int rc; |
@@ -1243,16 +1204,6 @@ static void do_cancel_buffers(struct cx23885_tsport *port, char *reason, | |||
1243 | spin_unlock_irqrestore(&port->slock, flags); | 1204 | spin_unlock_irqrestore(&port->slock, flags); |
1244 | } | 1205 | } |
1245 | 1206 | ||
1246 | void cx23885_cancel_buffers(struct cx23885_tsport *port) | ||
1247 | { | ||
1248 | struct cx23885_dev *dev = port->dev; | ||
1249 | struct cx23885_dmaqueue *q = &port->mpegq; | ||
1250 | |||
1251 | dprintk(1, "%s()\n", __FUNCTION__); | ||
1252 | del_timer_sync(&q->timeout); | ||
1253 | cx23885_stop_dma(port); | ||
1254 | do_cancel_buffers(port, "cancel", 0); | ||
1255 | } | ||
1256 | 1207 | ||
1257 | static void cx23885_timeout(unsigned long data) | 1208 | static void cx23885_timeout(unsigned long data) |
1258 | { | 1209 | { |