Skip to content

Commit

Permalink
[media] firedtv: drop obsolete backend abstraction
Browse files Browse the repository at this point in the history
Since the drivers/ieee1394/ backend was removed from firedtv, its I/O no
longer needs to be abstracted as exchangeable backend methods.

Also, ieee1394 variants of module and device probe and removal are no
longer there.  Move module probe and removal into firedtv-fw.c where
device probe and removal are implemented.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Stefan Richter authored and Mauro Carvalho Chehab committed Mar 21, 2011
1 parent 14ddc31 commit 92374e8
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 190 deletions.
15 changes: 5 additions & 10 deletions drivers/media/dvb/firewire/firedtv-avc.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ static int avc_write(struct firedtv *fdtv)
if (unlikely(avc_debug))
debug_fcp(fdtv->avc_data, fdtv->avc_data_length);

err = fdtv->backend->write(fdtv, FCP_COMMAND_REGISTER,
fdtv->avc_data, fdtv->avc_data_length);
err = fdtv_write(fdtv, FCP_COMMAND_REGISTER,
fdtv->avc_data, fdtv->avc_data_length);
if (err) {
dev_err(fdtv->device, "FCP command write failed\n");

Expand Down Expand Up @@ -1322,7 +1322,7 @@ static int cmp_read(struct firedtv *fdtv, u64 addr, __be32 *data)

mutex_lock(&fdtv->avc_mutex);

ret = fdtv->backend->read(fdtv, addr, data);
ret = fdtv_read(fdtv, addr, data);
if (ret < 0)
dev_err(fdtv->device, "CMP: read I/O error\n");

Expand All @@ -1340,7 +1340,7 @@ static int cmp_lock(struct firedtv *fdtv, u64 addr, __be32 data[])
/* data[] is stack-allocated and should not be DMA-mapped. */
memcpy(fdtv->avc_data, data, 8);

ret = fdtv->backend->lock(fdtv, addr, fdtv->avc_data);
ret = fdtv_lock(fdtv, addr, fdtv->avc_data);
if (ret < 0)
dev_err(fdtv->device, "CMP: lock I/O error\n");
else
Expand Down Expand Up @@ -1405,10 +1405,7 @@ int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel)
/* FIXME: this is for the worst case - optimize */
set_opcr_overhead_id(opcr, 0);

/*
* FIXME: allocate isochronous channel and bandwidth at IRM
* fdtv->backend->alloc_resources(fdtv, channels_mask, bw);
*/
/* FIXME: allocate isochronous channel and bandwidth at IRM */
}

set_opcr_p2p_connections(opcr, get_opcr_p2p_connections(*opcr) + 1);
Expand All @@ -1424,8 +1421,6 @@ int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel)
/*
* FIXME: if old_opcr.P2P_Connections > 0,
* deallocate isochronous channel and bandwidth at IRM
* if (...)
* fdtv->backend->dealloc_resources(fdtv, channel, bw);
*/

if (++attempts < 6) /* arbitrary limit */
Expand Down
130 changes: 3 additions & 127 deletions drivers/media/dvb/firewire/firedtv-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/wait.h>
#include <linux/workqueue.h>

#include <dmxdev.h>
#include <dvb_demux.h>
Expand Down Expand Up @@ -166,11 +161,11 @@ int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed)

DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);

int fdtv_dvb_register(struct firedtv *fdtv)
int fdtv_dvb_register(struct firedtv *fdtv, const char *name)
{
int err;

err = dvb_register_adapter(&fdtv->adapter, fdtv_model_names[fdtv->type],
err = dvb_register_adapter(&fdtv->adapter, name,
THIS_MODULE, fdtv->device, adapter_nr);
if (err < 0)
goto fail_log;
Expand Down Expand Up @@ -210,7 +205,7 @@ int fdtv_dvb_register(struct firedtv *fdtv)

dvb_net_init(&fdtv->adapter, &fdtv->dvbnet, &fdtv->demux.dmx);

fdtv_frontend_init(fdtv);
fdtv_frontend_init(fdtv, name);
err = dvb_register_frontend(&fdtv->adapter, &fdtv->fe);
if (err)
goto fail_net_release;
Expand Down Expand Up @@ -248,122 +243,3 @@ void fdtv_dvb_unregister(struct firedtv *fdtv)
dvb_dmx_release(&fdtv->demux);
dvb_unregister_adapter(&fdtv->adapter);
}

const char *fdtv_model_names[] = {
[FIREDTV_UNKNOWN] = "unknown type",
[FIREDTV_DVB_S] = "FireDTV S/CI",
[FIREDTV_DVB_C] = "FireDTV C/CI",
[FIREDTV_DVB_T] = "FireDTV T/CI",
[FIREDTV_DVB_S2] = "FireDTV S2 ",
};

struct firedtv *fdtv_alloc(struct device *dev,
const struct firedtv_backend *backend,
const char *name, size_t name_len)
{
struct firedtv *fdtv;
int i;

fdtv = kzalloc(sizeof(*fdtv), GFP_KERNEL);
if (!fdtv)
return NULL;

dev_set_drvdata(dev, fdtv);
fdtv->device = dev;
fdtv->isochannel = -1;
fdtv->voltage = 0xff;
fdtv->tone = 0xff;
fdtv->backend = backend;

mutex_init(&fdtv->avc_mutex);
init_waitqueue_head(&fdtv->avc_wait);
mutex_init(&fdtv->demux_mutex);
INIT_WORK(&fdtv->remote_ctrl_work, avc_remote_ctrl_work);

for (i = ARRAY_SIZE(fdtv_model_names); --i; )
if (strlen(fdtv_model_names[i]) <= name_len &&
strncmp(name, fdtv_model_names[i], name_len) == 0)
break;
fdtv->type = i;

return fdtv;
}

#define MATCH_FLAGS (IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID | \
IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION)

#define DIGITAL_EVERYWHERE_OUI 0x001287
#define AVC_UNIT_SPEC_ID_ENTRY 0x00a02d
#define AVC_SW_VERSION_ENTRY 0x010001

const struct ieee1394_device_id fdtv_id_table[] = {
{
/* FloppyDTV S/CI and FloppyDTV S2 */
.match_flags = MATCH_FLAGS,
.vendor_id = DIGITAL_EVERYWHERE_OUI,
.model_id = 0x000024,
.specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
.version = AVC_SW_VERSION_ENTRY,
}, {
/* FloppyDTV T/CI */
.match_flags = MATCH_FLAGS,
.vendor_id = DIGITAL_EVERYWHERE_OUI,
.model_id = 0x000025,
.specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
.version = AVC_SW_VERSION_ENTRY,
}, {
/* FloppyDTV C/CI */
.match_flags = MATCH_FLAGS,
.vendor_id = DIGITAL_EVERYWHERE_OUI,
.model_id = 0x000026,
.specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
.version = AVC_SW_VERSION_ENTRY,
}, {
/* FireDTV S/CI and FloppyDTV S2 */
.match_flags = MATCH_FLAGS,
.vendor_id = DIGITAL_EVERYWHERE_OUI,
.model_id = 0x000034,
.specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
.version = AVC_SW_VERSION_ENTRY,
}, {
/* FireDTV T/CI */
.match_flags = MATCH_FLAGS,
.vendor_id = DIGITAL_EVERYWHERE_OUI,
.model_id = 0x000035,
.specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
.version = AVC_SW_VERSION_ENTRY,
}, {
/* FireDTV C/CI */
.match_flags = MATCH_FLAGS,
.vendor_id = DIGITAL_EVERYWHERE_OUI,
.model_id = 0x000036,
.specifier_id = AVC_UNIT_SPEC_ID_ENTRY,
.version = AVC_SW_VERSION_ENTRY,
}, {}
};
MODULE_DEVICE_TABLE(ieee1394, fdtv_id_table);

static int __init fdtv_init(void)
{
int ret;

ret = fdtv_fw_init();
if (ret < 0)
return ret;

return ret;
}

static void __exit fdtv_exit(void)
{
fdtv_fw_exit();
}

module_init(fdtv_init);
module_exit(fdtv_exit);

MODULE_AUTHOR("Andreas Monitzer <andy@monitzer.com>");
MODULE_AUTHOR("Ben Backx <ben@bbackx.com>");
MODULE_DESCRIPTION("FireDTV DVB Driver");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("FireDTV DVB");
8 changes: 4 additions & 4 deletions drivers/media/dvb/firewire/firedtv-fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ static int fdtv_dvb_init(struct dvb_frontend *fe)
return err;
}

return fdtv->backend->start_iso(fdtv);
return fdtv_start_iso(fdtv);
}

static int fdtv_sleep(struct dvb_frontend *fe)
{
struct firedtv *fdtv = fe->sec_priv;

fdtv->backend->stop_iso(fdtv);
fdtv_stop_iso(fdtv);
cmp_break_pp_connection(fdtv, fdtv->subunit, fdtv->isochannel);
fdtv->isochannel = -1;
return 0;
Expand Down Expand Up @@ -165,7 +165,7 @@ static int fdtv_set_property(struct dvb_frontend *fe, struct dtv_property *tvp)
return 0;
}

void fdtv_frontend_init(struct firedtv *fdtv)
void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
{
struct dvb_frontend_ops *ops = &fdtv->fe.ops;
struct dvb_frontend_info *fi = &ops->info;
Expand Down Expand Up @@ -266,7 +266,7 @@ void fdtv_frontend_init(struct firedtv *fdtv)
dev_err(fdtv->device, "no frontend for model type %d\n",
fdtv->type);
}
strcpy(fi->name, fdtv_model_names[fdtv->type]);
strcpy(fi->name, name);

fdtv->fe.dvb = &fdtv->adapter;
fdtv->fe.sec_priv = fdtv;
Expand Down
Loading

0 comments on commit 92374e8

Please sign in to comment.