[PATCH 4/7] firedtv: some header cleanups

Stefan Richter stefanr at s5r6.in-berlin.de
Sun Aug 24 21:28:45 UTC 2008


Unify #ifndef/#define/#endif guards against multiple inclusion.
Drop extern keyword from function declarations.
Remove #include's into header files where struct declarations suffice.

Remove unused ohci1394 interface and related unused ieee1394 interfaces.

Add a few missing #include's and remove a few apparently obsolete ones.
Sort them alphabetically.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/ieee1394/dma.h                   |    1 
 drivers/ieee1394/iso.h                   |    1 
 drivers/media/dvb/firesat/avc_api.c      |   13 ++-
 drivers/media/dvb/firesat/avc_api.h      |   69 +++++++++---------
 drivers/media/dvb/firesat/cmp.c          |   15 ++--
 drivers/media/dvb/firesat/cmp.h          |   14 ++-
 drivers/media/dvb/firesat/firesat-ci.c   |   11 +--
 drivers/media/dvb/firesat/firesat-ci.h   |    8 +-
 drivers/media/dvb/firesat/firesat-rc.c   |    5 -
 drivers/media/dvb/firesat/firesat-rc.h   |   13 +--
 drivers/media/dvb/firesat/firesat.h      |   48 +++++++------
 drivers/media/dvb/firesat/firesat_1394.c |   84 ++++++-----------------
 drivers/media/dvb/firesat/firesat_dvb.c  |   21 +----
 drivers/media/dvb/firesat/firesat_fe.c   |   21 +----
 drivers/media/dvb/firesat/firesat_iso.c  |   10 ++
 15 files changed, 160 insertions(+), 174 deletions(-)

Index: linux/drivers/ieee1394/dma.h
===================================================================
--- linux.orig/drivers/ieee1394/dma.h
+++ linux/drivers/ieee1394/dma.h
@@ -12,6 +12,7 @@
 
 #include <asm/types.h>
 
+struct file;
 struct pci_dev;
 struct scatterlist;
 struct vm_area_struct;
Index: linux/drivers/ieee1394/iso.h
===================================================================
--- linux.orig/drivers/ieee1394/iso.h
+++ linux/drivers/ieee1394/iso.h
@@ -13,6 +13,7 @@
 #define IEEE1394_ISO_H
 
 #include <linux/spinlock_types.h>
+#include <linux/wait.h>
 #include <asm/atomic.h>
 #include <asm/types.h>
 
Index: linux/drivers/media/dvb/firesat/avc_api.c
===================================================================
--- linux.orig/drivers/media/dvb/firesat/avc_api.c
+++ linux/drivers/media/dvb/firesat/avc_api.c
@@ -11,13 +11,18 @@
  *	the License, or (at your option) any later version.
  */
 
-#include "firesat.h"
+#include <linux/crc32.h>
+#include <linux/delay.h>
+#include <linux/kernel.h>
+#include <linux/moduleparam.h>
+#include <linux/wait.h>
+#include <asm/atomic.h>
+
 #include <ieee1394_transactions.h>
 #include <nodemgr.h>
-#include <asm/byteorder.h>
-#include <linux/delay.h>
-#include <linux/crc32.h>
+
 #include "avc_api.h"
+#include "firesat.h"
 #include "firesat-rc.h"
 
 #define RESPONSE_REGISTER				0xFFFFF0000D00ULL
Index: linux/drivers/media/dvb/firesat/avc_api.h
===================================================================
--- linux.orig/drivers/media/dvb/firesat/avc_api.h
+++ linux/drivers/media/dvb/firesat/avc_api.h
@@ -16,10 +16,10 @@
  *	the License, or (at your option) any later version.
  */
 
-#ifndef __AVC_API_H__
-#define __AVC_API_H__
+#ifndef _AVC_API_H
+#define _AVC_API_H
 
-#include <linux/dvb/frontend.h>
+#include <linux/types.h>
 
 /*************************************************************
 	Constants from EN510221
@@ -409,34 +409,37 @@ typedef struct
 
 #define LNBCONTROL_DONTCARE 0xff
 
+struct dvb_diseqc_master_cmd;
+struct dvb_frontend_parameters;
+struct firesat;
+
+int AVCWrite(struct firesat *firesat, const AVCCmdFrm *CmdFrm,
+		AVCRspFrm *RspFrm);
+int AVCRecv(struct firesat *firesat, u8 *data, size_t length);
+
+int AVCTuner_DSIT(struct firesat *firesat, int Source_Plug,
+		struct dvb_frontend_parameters *params, __u8 *status);
+
+int AVCTunerStatus(struct firesat *firesat,
+		ANTENNA_INPUT_INFO *antenna_input_info);
+int AVCTuner_DSD(struct firesat *firesat,
+		struct dvb_frontend_parameters *params, __u8 *status);
+int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]);
+int AVCTuner_GetTS(struct firesat *firesat);
+
+int AVCIdentifySubunit(struct firesat *firesat);
+int AVCLNBControl(struct firesat *firesat, char voltage, char burst,
+		char conttone, char nrdiseq,
+		struct dvb_diseqc_master_cmd *diseqcmd);
+int AVCSubUnitInfo(struct firesat *firesat, char *subunitcount);
+int AVCRegisterRemoteControl(struct firesat *firesat);
+int AVCTuner_Host2Ca(struct firesat *firesat);
+int avc_ca_app_info(struct firesat *firesat, char *app_info, int *length);
+int avc_ca_info(struct firesat *firesat, char *app_info, int *length);
+int avc_ca_reset(struct firesat *firesat);
+int avc_ca_pmt(struct firesat *firesat, char *app_info, int length);
+int avc_ca_get_time_date(struct firesat *firesat, int *interval);
+int avc_ca_enter_menu(struct firesat *firesat);
+int avc_ca_get_mmi(struct firesat *firesat, char *mmi_object, int *length);
 
-extern int AVCWrite(struct firesat *firesat, const AVCCmdFrm *CmdFrm, AVCRspFrm *RspFrm);
-extern int AVCRecv(struct firesat *firesat, u8 *data, size_t length);
-
-extern int AVCTuner_DSIT(struct firesat *firesat,
-                           int Source_Plug,
-						   struct dvb_frontend_parameters *params,
-                           __u8 *status);
-
-extern int AVCTunerStatus(struct firesat *firesat, ANTENNA_INPUT_INFO *antenna_input_info);
-extern int AVCTuner_DSD(struct firesat *firesat, struct dvb_frontend_parameters *params, __u8 *status);
-extern int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]);
-extern int AVCTuner_GetTS(struct firesat *firesat);
-
-extern int AVCIdentifySubunit(struct firesat *firesat);
-extern int AVCLNBControl(struct firesat *firesat, char voltage, char burst, char conttone, char nrdiseq, struct dvb_diseqc_master_cmd *diseqcmd);
-extern int AVCSubUnitInfo(struct firesat *firesat, char *subunitcount);
-extern int AVCRegisterRemoteControl(struct firesat *firesat);
-extern int AVCTuner_Host2Ca(struct firesat *firesat);
-extern int avc_ca_app_info(struct firesat *firesat, char *app_info,
-			   int *length);
-extern int avc_ca_info(struct firesat *firesat, char *app_info, int *length);
-extern int avc_ca_reset(struct firesat *firesat);
-extern int avc_ca_pmt(struct firesat *firesat, char *app_info, int length);
-extern int avc_ca_get_time_date(struct firesat *firesat, int *interval);
-extern int avc_ca_enter_menu(struct firesat *firesat);
-extern int avc_ca_get_mmi(struct firesat *firesat, char *mmi_object,
-			  int *length);
-
-#endif
-
+#endif /* _AVC_API_H */
Index: linux/drivers/media/dvb/firesat/cmp.h
===================================================================
--- linux.orig/drivers/media/dvb/firesat/cmp.h
+++ linux/drivers/media/dvb/firesat/cmp.h
@@ -1,9 +1,11 @@
-#ifndef __FIRESAT__CMP_H_
-#define __FIRESAT__CMP_H_
+#ifndef _CMP_H
+#define _CMP_H
 
-#include "firesat.h"
+struct firesat;
 
-extern int try_CMPEstablishPPconnection(struct firesat *firesat, int output_plug, int iso_channel);
-extern int try_CMPBreakPPconnection(struct firesat *firesat, int output_plug,int iso_channel);
+int try_CMPEstablishPPconnection(struct firesat *firesat, int output_plug,
+		int iso_channel);
+int try_CMPBreakPPconnection(struct firesat *firesat, int output_plug,
+		int iso_channel);
 
-#endif
+#endif /* _CMP_H */
Index: linux/drivers/media/dvb/firesat/firesat-ci.h
===================================================================
--- linux.orig/drivers/media/dvb/firesat/firesat-ci.h
+++ linux/drivers/media/dvb/firesat/firesat-ci.h
@@ -1,9 +1,9 @@
-#ifndef __FIRESAT_CA_H
-#define __FIRESAT_CA_H
+#ifndef _FIREDTV_CI_H
+#define _FIREDTV_CI_H
 
-#include "firesat.h"
+struct firesat;
 
 int firesat_ca_init(struct firesat *firesat);
 void firesat_ca_release(struct firesat *firesat);
 
-#endif
+#endif /* _FIREDTV_CI_H */
Index: linux/drivers/media/dvb/firesat/firesat-rc.h
===================================================================
--- linux.orig/drivers/media/dvb/firesat/firesat-rc.h
+++ linux/drivers/media/dvb/firesat/firesat-rc.h
@@ -1,9 +1,10 @@
-#ifndef __FIRESAT_LIRC_H
-#define __FIRESAT_LIRC_H
+#ifndef _FIREDTV_RC_H
+#define _FIREDTV_RC_H
 
-extern int firesat_register_rc(void);
-extern int firesat_unregister_rc(void);
-extern int firesat_got_remotecontrolcode(u16 code);
+#include <linux/types.h>
 
-#endif
+int firesat_register_rc(void);
+int firesat_unregister_rc(void);
+int firesat_got_remotecontrolcode(u16 code);
 
+#endif /* _FIREDTV_RC_H */
Index: linux/drivers/media/dvb/firesat/firesat.h
===================================================================
--- linux.orig/drivers/media/dvb/firesat/firesat.h
+++ linux/drivers/media/dvb/firesat/firesat.h
@@ -10,21 +10,27 @@
  *	the License, or (at your option) any later version.
  */
 
-#ifndef __FIRESAT_H
-#define __FIRESAT_H
-
-#include "dvb_frontend.h"
-#include "dmxdev.h"
-#include "dvb_demux.h"
-#include "dvb_net.h"
+#ifndef _FIREDTV_H
+#define _FIREDTV_H
 
 #include <linux/version.h>
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25)
 #include <linux/semaphore.h>
 #endif
-#include <linux/dvb/frontend.h>
+
 #include <linux/dvb/dmx.h>
-#include <iso.h>
+#include <linux/dvb/frontend.h>
+#include <linux/list.h>
+#include <linux/spinlock_types.h>
+#include <linux/types.h>
+#include <linux/wait.h>
+#include <asm/atomic.h>
+
+#include <demux.h>
+#include <dmxdev.h>
+#include <dvb_demux.h>
+#include <dvb_net.h>
+#include <dvbdev.h>
 
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25)
 #define DVB_REGISTER_ADAPTER(x, y, z, w, v) dvb_register_adapter(x, y, z, w, v)
@@ -123,6 +129,10 @@ enum model_type {
 	FireSAT_DVB_S2  = 4,
 };
 
+struct hpsb_host;
+struct hpsb_iso;
+struct node_entry;
+
 struct firesat {
 	struct dvb_demux dvb_demux;
 
@@ -214,19 +224,19 @@ extern const char *firedtv_model_names[]
 extern struct list_head firesat_list;
 extern spinlock_t firesat_list_lock;
 
+struct device;
+
 /* firesat_dvb.c */
-extern int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed);
-extern int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
-extern int firesat_dvbdev_init(struct firesat *firesat,
-			       struct device *dev,
-			       struct dvb_frontend *fe);
+int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed);
+int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
+int firesat_dvbdev_init(struct firesat *firesat, struct device *dev,
+		struct dvb_frontend *fe);
 
 /* firesat_fe.c */
-extern int firesat_frontend_attach(struct firesat *firesat,
-				   struct dvb_frontend *fe);
+int firesat_frontend_attach(struct firesat *firesat, struct dvb_frontend *fe);
 
 /* firesat_iso.c */
-extern int setup_iso_channel(struct firesat *firesat);
-extern void tear_down_iso_channel(struct firesat *firesat);
+int setup_iso_channel(struct firesat *firesat);
+void tear_down_iso_channel(struct firesat *firesat);
 
-#endif
+#endif /* _FIREDTV_H */
Index: linux/drivers/media/dvb/firesat/firesat_dvb.c
===================================================================
--- linux.orig/drivers/media/dvb/firesat/firesat_dvb.c
+++ linux/drivers/media/dvb/firesat/firesat_dvb.c
@@ -10,25 +10,16 @@
  *	the License, or (at your option) any later version.
  */
 
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/wait.h>
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/time.h>
 #include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <ieee1394_hotplug.h>
-#include <nodemgr.h>
-#include <highlevel.h>
-#include <ohci1394.h>
-#include <hosts.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+
+#include <dvb_demux.h>
+#include <dvb_frontend.h>
 #include <dvbdev.h>
 
-#include "firesat.h"
 #include "avc_api.h"
-#include "cmp.h"
-#include "firesat-rc.h"
+#include "firesat.h"
 #include "firesat-ci.h"
 
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
Index: linux/drivers/media/dvb/firesat/cmp.c
===================================================================
--- linux.orig/drivers/media/dvb/firesat/cmp.c
+++ linux/drivers/media/dvb/firesat/cmp.c
@@ -10,15 +10,20 @@
  *	the License, or (at your option) any later version.
  */
 
-#include "cmp.h"
-#include <ieee1394.h>
-#include <nodemgr.h>
-#include <highlevel.h>
-#include <ohci1394.h>
+#include <linux/bug.h>
+#include <linux/hardirq.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+
 #include <hosts.h>
+#include <ieee1394.h>
 #include <ieee1394_core.h>
 #include <ieee1394_transactions.h>
+#include <nodemgr.h>
+
 #include "avc_api.h"
+#include "cmp.h"
+#include "firesat.h"
 
 typedef struct _OPCR
 {
Index: linux/drivers/media/dvb/firesat/firesat_1394.c
===================================================================
--- linux.orig/drivers/media/dvb/firesat/firesat_1394.c
+++ linux/drivers/media/dvb/firesat/firesat_1394.c
@@ -11,26 +11,33 @@
  *	the License, or (at your option) any later version.
  */
 
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/wait.h>
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/time.h>
+#include <linux/device.h>
 #include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <ieee1394_hotplug.h>
-#include <nodemgr.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <asm/atomic.h>
+
+#include <dmxdev.h>
+#include <dvb_demux.h>
+#include <dvb_frontend.h>
+#include <dvbdev.h>
+
+#include <csr1212.h>
 #include <highlevel.h>
-#include <ohci1394.h>
 #include <hosts.h>
-#include <dvbdev.h>
+#include <ieee1394_hotplug.h>
+#include <nodemgr.h>
 
-#include "firesat.h"
 #include "avc_api.h"
 #include "cmp.h"
-#include "firesat-rc.h"
+#include "firesat.h"
 #include "firesat-ci.h"
+#include "firesat-rc.h"
 
 #define FIRESAT_Vendor_ID   0x001287
 
@@ -75,52 +82,6 @@ MODULE_DEVICE_TABLE(ieee1394, firesat_id
 LIST_HEAD(firesat_list);
 spinlock_t firesat_list_lock = SPIN_LOCK_UNLOCKED;
 
-static void firesat_add_host(struct hpsb_host *host);
-static void firesat_remove_host(struct hpsb_host *host);
-static void firesat_host_reset(struct hpsb_host *host);
-
-static void fcp_request(struct hpsb_host *host,
-			int nodeid,
-			int direction,
-			int cts,
-			u8 *data,
-			size_t length);
-
-static struct hpsb_highlevel firesat_highlevel = {
-	.name		= "FireDTV",
-	.add_host	= firesat_add_host,
-	.remove_host	= firesat_remove_host,
-	.host_reset	= firesat_host_reset,
-	.fcp_request	= fcp_request,
-};
-
-static void firesat_add_host (struct hpsb_host *host)
-{
-	struct ti_ohci *ohci = (struct ti_ohci *)host->hostdata;
-
-	/* We only work with the OHCI-1394 driver */
-	if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME))
-		return;
-
-	if (!hpsb_create_hostinfo(&firesat_highlevel, host, 0)) {
-		printk(KERN_ERR "Cannot allocate hostinfo\n");
-		return;
-	}
-
-	hpsb_set_hostinfo(&firesat_highlevel, host, ohci);
-	hpsb_set_hostinfo_key(&firesat_highlevel, host, ohci->host->id);
-}
-
-static void firesat_remove_host (struct hpsb_host *host)
-{
-
-}
-
-static void firesat_host_reset(struct hpsb_host *host)
-{
-    printk(KERN_INFO "FireSAT host_reset (nodeid = 0x%x, hosts active = %d)\n",host->node_id,host->nodes_active);
-}
-
 static void fcp_request(struct hpsb_host *host,
 			int nodeid,
 			int direction,
@@ -352,6 +313,11 @@ static struct hpsb_protocol_driver fires
 	},
 };
 
+static struct hpsb_highlevel firesat_highlevel = {
+	.name		= "FireDTV",
+	.fcp_request	= fcp_request,
+};
+
 static int __init firesat_init(void)
 {
 	int ret;
Index: linux/drivers/media/dvb/firesat/firesat_fe.c
===================================================================
--- linux.orig/drivers/media/dvb/firesat/firesat_fe.c
+++ linux/drivers/media/dvb/firesat/firesat_fe.c
@@ -10,26 +10,15 @@
  *	the License, or (at your option) any later version.
  */
 
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/wait.h>
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/time.h>
 #include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <ieee1394_hotplug.h>
-#include <nodemgr.h>
-#include <highlevel.h>
-#include <ohci1394.h>
-#include <hosts.h>
-#include <dvbdev.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+
+#include <dvb_frontend.h>
 
-#include "firesat.h"
 #include "avc_api.h"
 #include "cmp.h"
-#include "firesat-rc.h"
-#include "firesat-ci.h"
+#include "firesat.h"
 
 static int firesat_dvb_init(struct dvb_frontend *fe)
 {
Index: linux/drivers/media/dvb/firesat/firesat-ci.c
===================================================================
--- linux.orig/drivers/media/dvb/firesat/firesat-ci.c
+++ linux/drivers/media/dvb/firesat/firesat-ci.c
@@ -10,13 +10,16 @@
  *	the License, or (at your option) any later version.
  */
 
-#include "firesat-ci.h"
-#include "firesat.h"
-#include "avc_api.h"
-
 #include <linux/dvb/ca.h>
+#include <linux/fs.h>
+#include <linux/module.h>
+
 #include <dvbdev.h>
 
+#include "avc_api.h"
+#include "firesat.h"
+#include "firesat-ci.h"
+
 static unsigned int ca_debug = 0;
 module_param(ca_debug, int, 0644);
 MODULE_PARM_DESC(ca_debug, "debug logging of ca system, default is 0 (no)");
Index: linux/drivers/media/dvb/firesat/firesat-rc.c
===================================================================
--- linux.orig/drivers/media/dvb/firesat/firesat-rc.c
+++ linux/drivers/media/dvb/firesat/firesat-rc.c
@@ -9,11 +9,10 @@
  *	the License, or (at your option) any later version.
  */
 
-#include "firesat.h"
-#include "firesat-rc.h"
-
 #include <linux/input.h>
 
+#include "firesat-rc.h"
+
 static u16 firesat_irtable[] = {
 	KEY_ESC,
 	KEY_F9,
Index: linux/drivers/media/dvb/firesat/firesat_iso.c
===================================================================
--- linux.orig/drivers/media/dvb/firesat/firesat_iso.c
+++ linux/drivers/media/dvb/firesat/firesat_iso.c
@@ -9,6 +9,16 @@
  *	the License, or (at your option) any later version.
  */
 
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+
+#include <dvb_demux.h>
+
+#include <dma.h>
+#include <iso.h>
+
 #include "firesat.h"
 
 static void rawiso_activity_cb(struct hpsb_iso *iso);

-- 
Stefan Richter
-=====-==--- =--- ==---
http://arcgraph.de/sr/




More information about the devel mailing list