firesat: copyrights, rename to firedtv, API conversions, fix remote control input

Combination of the following changes:

Tue, 26 Aug 2008 00:17:30 +0200 (CEST)
firedtv: fix remote control input

    and update the scancode-to-keycode mapping to a current model.  Per
    default, various media key keycodes are emitted which closely match what
    is printed on the remote.  Userland can modify the mapping by means of
    evdev ioctls.  (Not tested.)

    The old scancode-to-keycode mapping is left in the driver but cannot be
    modified by ioctls.  This preserves status quo for old remotes.

Tue, 26 Aug 2008 00:11:28 +0200 (CEST)
firedtv: replace tasklet by workqueue job

    Non-atomic context is a lot nicer to work with.

Sun, 24 Aug 2008 23:30:00 +0200 (CEST)
firedtv: move some code back to ieee1394 core

    Partially reverts "ieee1394: remove unused code" of Linux 2.6.25.

Sun, 24 Aug 2008 23:29:30 +0200 (CEST)
firedtv: replace semaphore by mutex

    firesat->avc_sem and ->demux_sem have been used exactly like a mutex.
    The only exception is the schedule_remotecontrol tasklet which did a
    down_trylock in atomic context.  This is not possible with
    mutex_trylock; however the whole remote control related code is
    non-functional anyway at the moment.  This should be fixed eventually,
    probably by turning the tasklet into a worqueue job.

    Convert everything else from semaphore to mutex.

    Also rewrite a few of the affected functions to unlock the mutex at a
    single exit point, instead of in several branches.

Sun, 24 Aug 2008 23:28:45 +0200 (CEST)
firedtv: some header cleanups

    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.

Sun, 24 Aug 2008 23:27:45 +0200 (CEST)
firedtv: nicer registration message and some initialization fixes

    Print the correct name in dvb_register_adapter().

    While we are at it, replace two switch cascades by one for loop, remove
    a superfluous member of struct firesat and of two unused arguments of
    AVCIdentifySubunit(), and fix bogus kfree's in firesat_dvbdev_init().

Tue, 26 Aug 2008 14:24:17 +0200 (CEST)
firesat: rename to firedtv

    Suggested by Andreas Monitzer.  Besides DVB-S/-S2 receivers, the driver
    also supports DVB-C and DVB-T receivers, hence the previous project name
    is too narrow now.

    Not yet done:  Rename source directory, files, types, variables...

Sun, 24 Aug 2008 23:26:23 +0200 (CEST)
firesat: add missing copyright notes

    Reported by Andreas Monitzer and Christian Dolzer.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
diff --git a/drivers/media/dvb/firesat/firesat.h b/drivers/media/dvb/firesat/firesat.h
index f0bac24..5f0de88e 100644
--- a/drivers/media/dvb/firesat/firesat.h
+++ b/drivers/media/dvb/firesat/firesat.h
@@ -1,8 +1,8 @@
 /*
- * FireSAT DVB driver
+ * FireDTV driver (formerly known as FireSAT)
  *
- * Copyright (c) ?
- * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se>
+ * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
+ * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
  *
  *	This program is free software; you can redistribute it and/or
  *	modify it under the terms of the GNU General Public License as
@@ -10,23 +10,27 @@
  *	the License, or (at your option) any later version.
  */
 
-#ifndef __FIRESAT_H
-#define __FIRESAT_H
+#ifndef _FIREDTV_H
+#define _FIREDTV_H
 
-#include "dvb_frontend.h"
-#include "dmxdev.h"
-#include "dvb_demux.h"
-#include "dvb_net.h"
+#include <linux/dvb/dmx.h>
+#include <linux/dvb/frontend.h>
+#include <linux/list.h>
+#include <linux/mutex.h>
+#include <linux/spinlock_types.h>
+#include <linux/types.h>
+#include <linux/wait.h>
+#include <linux/workqueue.h>
+#include <asm/atomic.h>
+
+#include <demux.h>
+#include <dmxdev.h>
+#include <dvb_demux.h>
+#include <dvb_net.h>
+#include <dvbdev.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>
-
-#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)
 #else
 #define DVB_REGISTER_ADAPTER(x, y, z, w, v) dvb_register_adapter(x, y, z, w)
@@ -116,15 +120,19 @@
 
 
 enum model_type {
-	FireSAT_DVB_S = 1,
-	FireSAT_DVB_C = 2,
-	FireSAT_DVB_T = 3,
-	FireSAT_DVB_S2 = 4
+	FireSAT_UNKNOWN = 0,
+	FireSAT_DVB_S   = 1,
+	FireSAT_DVB_C   = 2,
+	FireSAT_DVB_T   = 3,
+	FireSAT_DVB_S2  = 4,
 };
 
+struct hpsb_host;
+struct hpsb_iso;
+struct node_entry;
+
 struct firesat {
 	struct dvb_demux dvb_demux;
-	char *model_name;
 
 	/* DVB bits */
 	struct dvb_adapter		*adapter;
@@ -139,11 +147,10 @@
 	int				ca_last_command;
 	int				ca_time_interval;
 
-	struct semaphore		avc_sem;
+	struct mutex			avc_mutex;
 	wait_queue_head_t		avc_wait;
 	atomic_t			avc_reply_received;
-
-	atomic_t			reschedule_remotecontrol;
+	struct work_struct		remote_ctrl_work;
 
 	struct firesat_channel {
 		struct firesat *firesat;
@@ -154,7 +161,7 @@
 		int pid;
 		int type;	/* 1 - TS, 2 - Filter */
 	} channel[16];
-	struct semaphore		demux_sem;
+	struct mutex			demux_mutex;
 
 	/* needed by avc_api */
 	void *respfrm;
@@ -210,22 +217,23 @@
 	};
 };
 
+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 */