Commit 9d49da8a authored by Michael Hunold's avatar Michael Hunold Committed by Linus Torvalds

[PATCH] dvb: core changes

- [DVB] dvb-core: follow Linux coding style, kill dvb_ksyms.c and move the
  EXPORT_SYMBOLs to the files where the functions are, thanks to Adrian Bunk
  <bunk@stusta.de>

- [DVB] dvb-core: #if 0'ing unused code, make needlessly global code static,
  whitespace and newline cleanups, thanks to Adrian Bunk <bunk@stusta.de>

- [DVB] dvb_ca_en50221.c: support for KNC1/Cinergy CI modules, fix
  segfaults, enhanced poll_slot_status to support non-IRQ interfaces, Fix
  module usage count problem

- [DVB] dvb-frontend.c: core changes to support the refactorized frontend
  drivers
Signed-off-by: default avatarMichael Hunold <hunold@linuxtv.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b0da8f73
......@@ -42,18 +42,12 @@ MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
#define dprintk if (debug) printk
inline struct dmxdev_filter *
static inline struct dmxdev_filter *
dvb_dmxdev_file_to_filter(struct file *file)
{
return (struct dmxdev_filter *) file->private_data;
}
inline struct dmxdev_dvr *
dvb_dmxdev_file_to_dvr(struct dmxdev *dmxdev, struct file *file)
{
return (struct dmxdev_dvr *) file->private_data;
}
static inline void dvb_dmxdev_buffer_init(struct dmxdev_buffer *buffer)
{
buffer->data=NULL;
......@@ -846,7 +840,7 @@ static ssize_t dvb_dmxdev_read_sec(struct dmxdev_filter *dfil,
}
ssize_t
static ssize_t
dvb_demux_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
struct dmxdev_filter *dmxdevfilter=dvb_dmxdev_file_to_filter(file);
......@@ -1122,6 +1116,7 @@ dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter)
return 0;
}
EXPORT_SYMBOL(dvb_dmxdev_init);
void
dvb_dmxdev_release(struct dmxdev *dmxdev)
......@@ -1138,5 +1133,5 @@ dvb_dmxdev_release(struct dmxdev *dmxdev)
}
dmxdev->demux->close(dmxdev->demux);
}
EXPORT_SYMBOL(dvb_dmxdev_release);
This diff is collapsed.
......@@ -42,6 +42,9 @@
/* Structure describing a CA interface */
struct dvb_ca_en50221 {
/* the module owning this structure */
struct module* owner;
/* NOTE: the read_*, write_* and poll_slot_status functions must use locks as
* they may be called from several threads at once */
......@@ -62,7 +65,7 @@ struct dvb_ca_en50221 {
* Poll slot status.
* Only necessary if DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set
*/
int (*poll_slot_status)(struct dvb_ca_en50221* ca, int slot);
int (*poll_slot_status)(struct dvb_ca_en50221* ca, int slot, int open);
/* private data, used by caller */
void* data;
......
......@@ -424,7 +424,7 @@ void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK);
}
}
EXPORT_SYMBOL(dvb_dmx_swfilter_packet);
void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t count)
{
......@@ -439,6 +439,7 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t cou
spin_unlock(&demux->lock);
}
EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
......@@ -478,6 +479,7 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
bailout:
spin_unlock(&demux->lock);
}
EXPORT_SYMBOL(dvb_dmx_swfilter);
void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
{
......@@ -522,6 +524,7 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
bailout:
spin_unlock(&demux->lock);
}
EXPORT_SYMBOL(dvb_dmx_swfilter_204);
static struct dvb_demux_filter * dvb_dmx_filter_alloc(struct dvb_demux *demux)
......@@ -1163,6 +1166,7 @@ int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend *fronte
up(&dvbdemux->mutex);
return 0;
}
EXPORT_SYMBOL(dvbdmx_connect_frontend);
int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
......@@ -1176,6 +1180,7 @@ int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
up(&dvbdemux->mutex);
return 0;
}
EXPORT_SYMBOL(dvbdmx_disconnect_frontend);
static int dvbdmx_get_pes_pids(struct dmx_demux *demux, u16 *pids)
......@@ -1256,6 +1261,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
return 0;
}
EXPORT_SYMBOL(dvb_dmx_init);
int dvb_dmx_release(struct dvb_demux *dvbdemux)
......@@ -1269,3 +1275,5 @@ int dvb_dmx_release(struct dvb_demux *dvbdemux)
vfree(dvbdemux->feed);
return 0;
}
EXPORT_SYMBOL(dvb_dmx_release);
......@@ -3,19 +3,20 @@
#include <linux/string.h>
#include "dvb_filter.h"
unsigned int bitrates[3][16] =
#if 0
static unsigned int bitrates[3][16] =
{{0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,0},
{0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,0},
{0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,0}};
#endif
u32 freq[4] = {441, 480, 320, 0};
static u32 freq[4] = {480, 441, 320, 0};
unsigned int ac3_bitrates[32] =
static unsigned int ac3_bitrates[32] =
{32,40,48,56,64,80,96,112,128,160,192,224,256,320,384,448,512,576,640,
0,0,0,0,0,0,0,0,0,0,0,0,0};
u32 ac3_freq[4] = {480, 441, 320, 0};
u32 ac3_frames[3][32] =
static u32 ac3_frames[3][32] =
{{64,80,96,112,128,160,192,224,256,320,384,448,512,640,768,896,1024,
1152,1280,0,0,0,0,0,0,0,0,0,0,0,0,0},
{69,87,104,121,139,174,208,243,278,348,417,487,557,696,835,975,1114,
......@@ -389,6 +390,7 @@ int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int p
return 0;
}
EXPORT_SYMBOL(dvb_filter_get_ac3info);
#if 0
......@@ -563,6 +565,7 @@ void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid,
p2ts->cb=cb;
p2ts->priv=priv;
}
EXPORT_SYMBOL(dvb_filter_pes2ts_init);
int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes,
int len, int payload_start)
......@@ -597,4 +600,5 @@ int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes,
memcpy(buf+5+rest, pes, len);
return p2ts->cb(p2ts->priv, buf);
}
EXPORT_SYMBOL(dvb_filter_pes2ts);
This diff is collapsed.
/*
* dvb_frontend.h
*
* Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
* overhauled by Holger Waechtler for Convergence GmbH
* Copyright (C) 2001 convergence integrated media GmbH
* Copyright (C) 2004 convergence GmbH
*
* Written by Ralph Metzler
* Overhauled by Holger Waechtler
* Kernel I2C stuff by Michael Hunold <hunold@convergence.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
......@@ -38,8 +41,8 @@
#include "dvbdev.h"
/* FIXME: Move to i2c-id.h */
#define I2C_DRIVERID_DVBFE_ALPS_TDLB7 I2C_DRIVERID_EXP2
#define I2C_DRIVERID_DVBFE_ALPS_TDMB7 I2C_DRIVERID_EXP2
#define I2C_DRIVERID_DVBFE_SP8870 I2C_DRIVERID_EXP2
#define I2C_DRIVERID_DVBFE_CX22700 I2C_DRIVERID_EXP2
#define I2C_DRIVERID_DVBFE_AT76C651 I2C_DRIVERID_EXP2
#define I2C_DRIVERID_DVBFE_CX24110 I2C_DRIVERID_EXP2
#define I2C_DRIVERID_DVBFE_CX22702 I2C_DRIVERID_EXP2
......@@ -56,22 +59,8 @@
#define I2C_DRIVERID_DVBFE_TDA8083 I2C_DRIVERID_EXP2
#define I2C_DRIVERID_DVBFE_VES1820 I2C_DRIVERID_EXP2
#define I2C_DRIVERID_DVBFE_VES1X93 I2C_DRIVERID_EXP2
#define I2C_DRIVERID_DVBFE_TDA80XX I2C_DRIVERID_EXP2
/**
* when before_ioctl is registered and returns value 0, ioctl and after_ioctl
* are not executed.
*/
struct dvb_frontend {
int (*before_ioctl) (struct dvb_frontend *frontend, unsigned int cmd, void *arg);
int (*ioctl) (struct dvb_frontend *frontend, unsigned int cmd, void *arg);
int (*after_ioctl) (struct dvb_frontend *frontend, unsigned int cmd, void *arg);
void (*notifier_callback) (fe_status_t s, void *data);
struct dvb_adapter *dvb_adapter;
void *before_after_data; /* can be used by hardware module... */
void *notifier_data; /* can be used by hardware module... */
void *data; /* can be used by hardware module... */
};
struct dvb_frontend_tune_settings {
int min_delay_ms;
......@@ -80,67 +69,47 @@ struct dvb_frontend_tune_settings {
struct dvb_frontend_parameters parameters;
};
struct dvb_frontend;
/**
* private frontend command ioctl's.
* keep them in sync with the public ones defined in linux/dvb/frontend.h
*
* FE_SLEEP. Ioctl used to put frontend into a low power mode.
* FE_INIT. Ioctl used to initialise the frontend.
* FE_GET_TUNE_SETTINGS. Get the frontend-specific tuning loop settings for the supplied set of parameters.
*/
#define FE_SLEEP _IO('v', 80)
#define FE_INIT _IO('v', 81)
#define FE_GET_TUNE_SETTINGS _IOWR('v', 83, struct dvb_frontend_tune_settings)
#define FE_REGISTER _IO ('v', 84)
#define FE_UNREGISTER _IO ('v', 85)
extern int
dvb_register_frontend (int (*ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg),
struct dvb_adapter *dvb_adapter,
void *data,
struct dvb_frontend_info *info,
struct module *module);
extern int
dvb_unregister_frontend (int (*ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg),
struct dvb_adapter *dvb_adapter);
/**
* Add special ioctl code performed before and after the main ioctl
* to all frontend devices on the specified DVB adapter.
* This is necessairy because the 22kHz/13V-18V/DiSEqC stuff depends
* heavily on the hardware around the frontend, the same tuner can create
* these signals on about a million different ways...
*
* Return value: number of frontends where the ioctl's were applied.
*/
extern int
dvb_add_frontend_ioctls (struct dvb_adapter *adapter,
int (*before_ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg),
int (*after_ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg),
void *before_after_data);
extern void
dvb_remove_frontend_ioctls (struct dvb_adapter *adapter,
int (*before_ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg),
int (*after_ioctl) (struct dvb_frontend *frontend,
unsigned int cmd, void *arg));
extern int
dvb_add_frontend_notifier (struct dvb_adapter *adapter,
void (*callback) (fe_status_t s, void *data),
void *data);
extern void
dvb_remove_frontend_notifier (struct dvb_adapter *adapter,
void (*callback) (fe_status_t s, void *data));
struct dvb_frontend_ops {
#endif
struct dvb_frontend_info info;
void (*release)(struct dvb_frontend* fe);
int (*init)(struct dvb_frontend* fe);
int (*sleep)(struct dvb_frontend* fe);
int (*set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
int (*get_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings);
int (*read_status)(struct dvb_frontend* fe, fe_status_t* status);
int (*read_ber)(struct dvb_frontend* fe, u32* ber);
int (*read_signal_strength)(struct dvb_frontend* fe, u16* strength);
int (*read_snr)(struct dvb_frontend* fe, u16* snr);
int (*read_ucblocks)(struct dvb_frontend* fe, u32* ucblocks);
int (*diseqc_reset_overload)(struct dvb_frontend* fe);
int (*diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd);
int (*diseqc_recv_slave_reply)(struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply);
int (*diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);
int (*set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, int arg);
int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned int cmd);
};
struct dvb_frontend {
struct dvb_frontend_ops* ops;
struct dvb_adapter *dvb;
void* demodulator_priv;
};
extern int dvb_register_frontend(struct dvb_adapter* dvb,
struct dvb_frontend* fe);
extern int dvb_unregister_frontend(struct dvb_frontend* fe);
#endif
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/ioctl.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include "dmxdev.h"
#include "dvb_demux.h"
#include "dvb_frontend.h"
#include "dvb_net.h"
#include "dvb_filter.h"
#include "dvb_ca_en50221.h"
EXPORT_SYMBOL(dvb_dmxdev_init);
EXPORT_SYMBOL(dvb_dmxdev_release);
EXPORT_SYMBOL(dvb_dmx_init);
EXPORT_SYMBOL(dvb_dmx_release);
EXPORT_SYMBOL(dvb_dmx_swfilter_packet);
EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
EXPORT_SYMBOL(dvb_dmx_swfilter);
EXPORT_SYMBOL(dvb_dmx_swfilter_204);
EXPORT_SYMBOL(dvbdmx_connect_frontend);
EXPORT_SYMBOL(dvbdmx_disconnect_frontend);
EXPORT_SYMBOL(dvb_register_frontend);
EXPORT_SYMBOL(dvb_unregister_frontend);
EXPORT_SYMBOL(dvb_add_frontend_ioctls);
EXPORT_SYMBOL(dvb_remove_frontend_ioctls);
EXPORT_SYMBOL(dvb_add_frontend_notifier);
EXPORT_SYMBOL(dvb_remove_frontend_notifier);
EXPORT_SYMBOL(dvb_net_init);
EXPORT_SYMBOL(dvb_net_release);
EXPORT_SYMBOL(dvb_register_adapter);
EXPORT_SYMBOL(dvb_unregister_adapter);
EXPORT_SYMBOL(dvb_register_device);
EXPORT_SYMBOL(dvb_unregister_device);
EXPORT_SYMBOL(dvb_generic_ioctl);
EXPORT_SYMBOL(dvb_generic_open);
EXPORT_SYMBOL(dvb_generic_release);
EXPORT_SYMBOL(dvb_filter_pes2ts_init);
EXPORT_SYMBOL(dvb_filter_pes2ts);
EXPORT_SYMBOL(dvb_filter_get_ac3info);
EXPORT_SYMBOL(dvb_ca_en50221_init);
EXPORT_SYMBOL(dvb_ca_en50221_release);
EXPORT_SYMBOL(dvb_ca_en50221_frda_irq);
EXPORT_SYMBOL(dvb_ca_en50221_camchange_irq);
EXPORT_SYMBOL(dvb_ca_en50221_camready_irq);
......@@ -30,6 +30,7 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
......@@ -141,7 +142,11 @@ static unsigned short dvb_net_eth_type_trans(struct sk_buff *skb,
skb->mac.raw=skb->data;
skb_pull(skb,dev->hard_header_len);
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,8)
eth = skb->mac.ethernet;
#else
eth = eth_hdr(skb);
#endif
if (*eth->h_dest & 1) {
if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
......@@ -1193,6 +1198,7 @@ void dvb_net_release (struct dvb_net *dvbnet)
dvb_net_remove_if(dvbnet, i);
}
}
EXPORT_SYMBOL(dvb_net_release);
int dvb_net_init (struct dvb_adapter *adap, struct dvb_net *dvbnet,
......@@ -1210,4 +1216,4 @@ int dvb_net_init (struct dvb_adapter *adap, struct dvb_net *dvbnet,
return 0;
}
EXPORT_SYMBOL(dvb_net_init);
......@@ -132,6 +132,7 @@ int dvb_generic_open(struct inode *inode, struct file *file)
dvbdev->users--;
return 0;
}
EXPORT_SYMBOL(dvb_generic_open);
int dvb_generic_release(struct inode *inode, struct file *file)
......@@ -150,6 +151,7 @@ int dvb_generic_release(struct inode *inode, struct file *file)
dvbdev->users++;
return 0;
}
EXPORT_SYMBOL(dvb_generic_release);
int dvb_generic_ioctl(struct inode *inode, struct file *file,
......@@ -165,6 +167,7 @@ int dvb_generic_ioctl(struct inode *inode, struct file *file,
return dvb_usercopy (inode, file, cmd, arg, dvbdev->kernel_ioctl);
}
EXPORT_SYMBOL(dvb_generic_ioctl);
static int dvbdev_get_free_id (struct dvb_adapter *adap, int type)
......@@ -235,6 +238,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
return 0;
}
EXPORT_SYMBOL(dvb_register_device);
void dvb_unregister_device(struct dvb_device *dvbdev)
......@@ -251,6 +255,7 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
list_del(&dvbdev->list_head);
kfree(dvbdev);
}
EXPORT_SYMBOL(dvb_unregister_device);
static int dvbdev_get_free_adapter_num (void)
......@@ -309,6 +314,7 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name, struct mo
return num;
}
EXPORT_SYMBOL(dvb_register_adapter);
int dvb_unregister_adapter(struct dvb_adapter *adap)
......@@ -322,6 +328,7 @@ int dvb_unregister_adapter(struct dvb_adapter *adap)
kfree (adap);
return 0;
}
EXPORT_SYMBOL(dvb_unregister_adapter);
/* if the miracle happens and "generic_usercopy()" is included into
the kernel, then this can vanish. please don't make the mistake and
......
......@@ -49,6 +49,7 @@ struct dvb_adapter {
struct list_head device_list;
const char *name;
u8 proposed_mac [6];
void* priv;
struct module *module;
};
......
......@@ -78,7 +78,7 @@ struct dvb_frontend_info {
__u32 symbol_rate_min;
__u32 symbol_rate_max;
__u32 symbol_rate_tolerance; /* ppm */
__u32 notifier_delay; /* ms */
__u32 notifier_delay; /* DEPRECATED */
fe_caps_t caps;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment