Skip to contentSkip to conversation

conditionally #ifdef-out unused DiB3000M-C/P functions

PATCH In review Marc Koschewski 2 participants 4 messages Dec 21, 2005 – Dec 23, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 conditionally #ifdef-out unused DiB3000M-C/P functions

The following tiny patch removes the two DiB3000M-C/P functions

int dibusb_dib3000mc_tuner_attach()
int dibusb_dib3000mc_frontend_attach()

that are not needed in case the module is not compiled. The modules a800 as well as nova-t-usb2 select DVB_DIB3000MB in Kconfig thus the functions will be enabled due to the module being compiled.

Regards,
Marc

*** dibusb-common.c-orig 2005-12-21 11:04:49.000000000 +0100
--- dibusb-common.c 2005-12-21 11:05:32.000000000 +0100
*************** int dibusb_read_eeprom_byte(struct dvb_u *** 168,173 ****
--- 168,174 ----
}
EXPORT_SYMBOL(dibusb_read_eeprom_byte);

+ #ifdef CONFIG_DVB_USB_DIBUSB_MC
int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) {
struct dib3000_config demod_cfg;
*************** int dibusb_dib3000mc_tuner_attach (struc *** 193,198 ****
--- 194,200 ----
return 0;
}
EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);
+ #endif

/*
* common remote control stuff

#1 lore raw

Re: [PATCH 2/2] conditionally #ifdef-out unused DiB3000M-C/P defs

This removes the declarations as well.

*** dibusb.h-orig 2005-12-21 14:49:08.000000000 +0100
--- dibusb.h 2005-12-21 14:49:30.000000000 +0100
*************** struct dibusb_state {
*** 104,111 ****
--- 104,113 ----

extern struct i2c_algorithm dibusb_i2c_algo;

+ #ifdef CONFIG_DVB_USB_DIBUSB_MC
extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *); extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *);
+ #endif

  extern int dibusb_streaming_ctrl(struct dvb_usb_device *, int);
  extern int dibusb_pid_filter(struct dvb_usb_device *, int, u16, int);
#2 lore raw

Re: [PATCH 2/2] conditionally #ifdef-out unused DiB3000M-C/P defs

Quoted 8 lines · Marc Koschewski

This removes the declarations as well.

*** dibusb.h-orig 2005-12-21 14:49:08.000000000 +0100
--- dibusb.h 2005-12-21 14:49:30.000000000 +0100
*************** struct dibusb_state {
*** 104,111 ****
--- 104,113 ----

Quoted 7 lines

extern struct i2c_algorithm dibusb_i2c_algo;

+ #ifdef CONFIG_DVB_USB_DIBUSB_MC
extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *); extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *);
+ #endif
...

There's no need to #ifdef function declarations away.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw
In reply to Marc Koschewski
Quoted 8 lines · Marc Koschewski

The following tiny patch removes the two DiB3000M-C/P functions

int dibusb_dib3000mc_tuner_attach()
int dibusb_dib3000mc_frontend_attach()

that are not needed in case the module is not compiled. The modules a800 as well as nova-t-usb2 select DVB_DIB3000MB in Kconfig thus the functions will be enabled due to the module being compiled.

In theory, you could add #ifdef's in thousands of places of the kernel around functions similarly small to these two ones or sometimes bigger functions.

In practice, this would cause breakages in many configurations because the #ifdef's might either be wrong (as in your patch) or become wrong over time.

Quoted 11 lines

Regards,
Marc

*** dibusb-common.c-orig 2005-12-21 11:04:49.000000000 +0100
--- dibusb-common.c 2005-12-21 11:05:32.000000000 +0100
*************** int dibusb_read_eeprom_byte(struct dvb_u *** 168,173 ****
--- 168,174 ----
}
EXPORT_SYMBOL(dibusb_read_eeprom_byte);

Quoted 2 lines

+ #ifdef CONFIG_DVB_USB_DIBUSB_MC
...

This breaks with DVB_USB_DIBUSB_MC=m.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed