2005-11-20 02:44:35

by Adrian Bunk

[permalink] [raw]
Subject: [2.6 patch] drivers/media/video/: make code static

This patch makes needlessly global code static.


drivers/media/video/bttv-cards.c | 6 +++---
drivers/media/video/cx25840/cx25840-core.c | 4 ++--
drivers/media/video/em28xx/em28xx-core.c | 6 +++---
drivers/media/video/em28xx/em28xx-video.c | 2 +-
drivers/media/video/saa7127.c | 6 +++---
drivers/media/video/saa7134/saa7134-alsa.c | 9 +++++----
drivers/media/video/saa7134/saa7134-oss.c | 4 ++--
7 files changed, 19 insertions(+), 18 deletions(-)


Signed-off-by: Adrian Bunk <[email protected]>

---

--- linux-2.6.15-rc1-mm2-full/drivers/media/video/em28xx/em28xx-video.c.old 2005-11-20 02:48:40.000000000 +0100
+++ linux-2.6.15-rc1-mm2-full/drivers/media/video/em28xx/em28xx-video.c 2005-11-20 02:48:51.000000000 +0100
@@ -226,7 +226,7 @@
* em28xx_config_i2c()
* configure i2c attached devices
*/
-void em28xx_config_i2c(struct em28xx *dev)
+static void em28xx_config_i2c(struct em28xx *dev)
{
struct v4l2_frequency f;
struct video_decoder_init em28xx_vdi = {.data = NULL };
--- linux-2.6.15-rc1-mm2-full/drivers/media/video/saa7134/saa7134-alsa.c.old 2005-11-20 02:49:12.000000000 +0100
+++ linux-2.6.15-rc1-mm2-full/drivers/media/video/saa7134/saa7134-alsa.c 2005-11-20 02:58:01.000000000 +0100
@@ -58,7 +58,7 @@
module_param_array(index, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s).");

-int position;
+static int position;

#define dprintk(fmt, arg...) if (debug) \
printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg)
@@ -140,7 +140,8 @@
*
*/

-void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status)
+static void saa7134_irq_alsa_done(struct saa7134_dev *dev,
+ unsigned long status)
{
int next_blk, reg = 0;

@@ -881,7 +882,7 @@
*
*/

-int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
+static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
{

snd_card_t *card;
@@ -994,7 +995,7 @@
* Module destructor
*/

-void saa7134_alsa_exit(void)
+static void saa7134_alsa_exit(void)
{
int idx;

--- linux-2.6.15-rc1-mm2-full/drivers/media/video/saa7134/saa7134-oss.c.old 2005-11-20 02:50:22.000000000 +0100
+++ linux-2.6.15-rc1-mm2-full/drivers/media/video/saa7134/saa7134-oss.c 2005-11-20 02:58:15.000000000 +0100
@@ -899,7 +899,7 @@
spin_unlock(&dev->slock);
}

-int saa7134_dsp_create(struct saa7134_dev *dev)
+static int saa7134_dsp_create(struct saa7134_dev *dev)
{
int err;

@@ -955,7 +955,7 @@

}

-void saa7134_oss_exit(void)
+static void saa7134_oss_exit(void)
{
struct saa7134_dev *dev = NULL;
struct list_head *list;
--- linux-2.6.15-rc1-mm2-full/drivers/media/video/bttv-cards.c.old 2005-11-20 02:52:53.000000000 +0100
+++ linux-2.6.15-rc1-mm2-full/drivers/media/video/bttv-cards.c 2005-11-20 02:54:11.000000000 +0100
@@ -2904,7 +2904,7 @@
*/

/* Some Modular Technology cards have an eeprom, but no subsystem ID */
-void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
+static void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
{
int type = -1;

@@ -3879,7 +3879,7 @@
* error. ERROR_CPLD_Check_Failed.
*/
/* ----------------------------------------------------------------------- */
-void
+static void
init_RTV24 (struct bttv *btv)
{
uint32_t dataRead = 0;
@@ -4103,7 +4103,7 @@
/* ----------------------------------------------------------------------- */
/* winview */

-void winview_audio(struct bttv *btv, struct video_audio *v, int set)
+static void winview_audio(struct bttv *btv, struct video_audio *v, int set)
{
/* PT2254A programming Jon Tombs, [email protected] */
int bits_out, loops, vol, data;
--- linux-2.6.15-rc1-mm2-full/drivers/media/video/cx25840/cx25840-core.c.old 2005-11-20 02:55:12.000000000 +0100
+++ linux-2.6.15-rc1-mm2-full/drivers/media/video/cx25840/cx25840-core.c 2005-11-20 02:55:23.000000000 +0100
@@ -714,7 +714,7 @@

/* ----------------------------------------------------------------------- */

-struct i2c_driver i2c_driver_cx25840;
+static struct i2c_driver i2c_driver_cx25840;

static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
int kind)
@@ -807,7 +807,7 @@

/* ----------------------------------------------------------------------- */

-struct i2c_driver i2c_driver_cx25840 = {
+static struct i2c_driver i2c_driver_cx25840 = {
.name = "cx25840",

.id = I2C_DRIVERID_CX25840,
--- linux-2.6.15-rc1-mm2-full/drivers/media/video/em28xx/em28xx-core.c.old 2005-11-20 02:56:08.000000000 +0100
+++ linux-2.6.15-rc1-mm2-full/drivers/media/video/em28xx/em28xx-core.c 2005-11-20 02:56:36.000000000 +0100
@@ -32,7 +32,7 @@

/* #define ENABLE_DEBUG_ISOC_FRAMES */

-unsigned int core_debug;
+static unsigned int core_debug;
module_param(core_debug,int,0644);
MODULE_PARM_DESC(core_debug,"enable debug messages [core]");

@@ -41,7 +41,7 @@
printk(KERN_INFO "%s %s :"fmt, \
dev->name, __FUNCTION__ , ##arg); } while (0)

-unsigned int reg_debug;
+static unsigned int reg_debug;
module_param(reg_debug,int,0644);
MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]");

@@ -50,7 +50,7 @@
printk(KERN_INFO "%s %s :"fmt, \
dev->name, __FUNCTION__ , ##arg); } while (0)

-unsigned int isoc_debug;
+static unsigned int isoc_debug;
module_param(isoc_debug,int,0644);
MODULE_PARM_DESC(isoc_debug,"enable debug messages [isoc transfers]");

--- linux-2.6.15-rc1-mm2-full/drivers/media/video/saa7127.c.old 2005-11-20 03:00:36.000000000 +0100
+++ linux-2.6.15-rc1-mm2-full/drivers/media/video/saa7127.c 2005-11-20 03:00:59.000000000 +0100
@@ -223,7 +223,7 @@
};

#define SAA7127_50HZ_DAC_CONTROL 0x02
-struct i2c_reg_value saa7127_init_config_50hz[] = {
+static struct i2c_reg_value saa7127_init_config_50hz[] = {
{ SAA7127_REG_BURST_START, 0x21 },
/* BURST_END is also used as a chip ID in saa7127_detect_client */
{ SAA7127_REG_BURST_END, 0x1d },
@@ -696,7 +696,7 @@

/* ----------------------------------------------------------------------- */

-struct i2c_driver i2c_driver_saa7127;
+static struct i2c_driver i2c_driver_saa7127;

/* ----------------------------------------------------------------------- */

@@ -818,7 +818,7 @@

/* ----------------------------------------------------------------------- */

-struct i2c_driver i2c_driver_saa7127 = {
+static struct i2c_driver i2c_driver_saa7127 = {
.name = "saa7127",
.id = I2C_DRIVERID_SAA7127,
.flags = I2C_DF_NOTIFY,


2005-11-20 15:47:41

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: [2.6 patch] drivers/media/video/: make code static

Adrian,

Em Dom, 2005-11-20 ?s 03:44 +0100, Adrian Bunk escreveu:
> This patch makes needlessly global code static.
>
>
> drivers/media/video/bttv-cards.c | 6 +++---
> drivers/media/video/cx25840/cx25840-core.c | 4 ++--
> drivers/media/video/em28xx/em28xx-core.c | 6 +++---
> drivers/media/video/em28xx/em28xx-video.c | 2 +-
> drivers/media/video/saa7127.c | 6 +++---
> drivers/media/video/saa7134/saa7134-alsa.c | 9 +++++----
> drivers/media/video/saa7134/saa7134-oss.c | 4 ++--
> 7 files changed, 19 insertions(+), 18 deletions(-)
>
>
> Signed-off-by: Adrian Bunk <[email protected]>
Thanks for your patch.

> --- linux-2.6.15-rc1-mm2-full/drivers/media/video/saa7134/saa7134-alsa.c.old 2005-11-20 02:49:12.000000000 +0100
> +++ linux-2.6.15-rc1-mm2-full/drivers/media/video/saa7134/saa7134-alsa.c 2005-11-20 02:58:01.000000000 +0100
> @@ -58,7 +58,7 @@
> module_param_array(index, int, NULL, 0444);
> MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s).");
>
> -int position;
> +static int position;

This didn't applied at V4L tree. This flag was removed at the latest
version. We had already a patch including static on some I2C structs and
other trivial fixes.
I'll added your patch with fixes on my tree and send to -mm in the next
V4L patchsets, after the patch that removes position and fixes some
stuff at saa7134-alsa.

Cheers,
Mauro.

2005-12-01 19:47:45

by Olaf Hering

[permalink] [raw]
Subject: Re: [2.6 patch] drivers/media/video/: make code static

On Sun, Nov 20, Adrian Bunk wrote:

> drivers/media/video/cx25840/cx25840-core.c | 4 ++--

> --- linux-2.6.15-rc1-mm2-full/drivers/media/video/cx25840/cx25840-core.c.old 2005-11-20 02:55:12.000000000 +0100
> +++ linux-2.6.15-rc1-mm2-full/drivers/media/video/cx25840/cx25840-core.c 2005-11-20 02:55:23.000000000 +0100
> @@ -714,7 +714,7 @@
>
> /* ----------------------------------------------------------------------- */
>
> -struct i2c_driver i2c_driver_cx25840;
> +static struct i2c_driver i2c_driver_cx25840;
>
> static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
> int kind)
> @@ -807,7 +807,7 @@
>
> /* ----------------------------------------------------------------------- */
>
> -struct i2c_driver i2c_driver_cx25840 = {
> +static struct i2c_driver i2c_driver_cx25840 = {
> .name = "cx25840",
>
> .id = I2C_DRIVERID_CX25840,

Why does it exist twice? Once uninitalized, once intialized? Appearently
I miss the point. I also dont find the place where ->command is called.

There are other problems with this driver. If VIDIOC_S_STD gets passed
to cx25840_command, set_v4lstd will get a 64bit value as second arg. gcc
for ppc generates calls to __ucmpdi2, from libgcc.
Only a few archs implement this function inside the kernel. Maybe this
driver should become arm/fvr/h8300 only in 2.6.15?

--
short story of a lazy sysadmin:
alias appserv=wotan