From: Antti Palosaari <crope@iki.fi>
To: linux-media <linux-media@vger.kernel.org>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>,
Mauro Carvalho Chehab <mchehab@redhat.com>
Subject: [RFCv1] DVB-USB improvements [alternative 2]
Date: Sun, 20 May 2012 23:55:23 +0300 [thread overview]
Message-ID: <4FB95A3B.9070800@iki.fi> (raw)
I did some more planning and made alternative RFC.
As the earlier alternative was more like changing old functionality that
new one goes much more deeper.
As a basic rule I designed it to reduce stuff from the current struct
dvb_usb_device_properties. Currently there is many nested structs
introducing same callbacks. For that one I dropped all frontend and
adapter level callbacks to device level. Currently struct contains 2
adapters and 3 frontends - which means we have 2 * 3 = 6 "similar"
callbacks and only 1 is used. It wastes some space since devices having
more than one adapter or frontend are rather rare. Making callback
selection inside individual driver is very trivial even without a
designated callback. Here is common example from the use of
.frontend_attach() callback in case of only one callback used:
static int frontend_attach(struct dvb_usb_adapter *adap)
{
if (adap->id == 0)
return frontend_attach_1();
else
return frontend_attach_2();
}
Functionality enhancement mentioned earlier RFC are valid too:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg46352.html
As I was a little bit lazy I wrote only quick skeleton code to represent
new simplified "struct dvb_usb_device_properties":
struct dvb_usb_device_properties = {
/* download_firmware() success return values to signal what happens
next */
#define RECONNECTS_USB (1 << 0)
#define RECONNECTS_USB_USING_NEW_ID (1 << 1)
.size_of_priv = sizeof(struct 'state'),
/* firmware download */
.identify_state(struct dvb_usb_device *d, int *cold),
.get_firmware_name(struct dvb_usb_device *d, char *firmware_name),
.download_firmware(struct dvb_usb_device *d, const struct firmware *fw),
.allow_dynamic_id = true,
.power_ctrl(struct dvb_usb_device *d, int onoff),
.read_config(struct dvb_usb_device *d, u8 mac[6]),
.get_adapter_count(struct dvb_usb_device *d, int *count),
.frontend_attach(struct dvb_usb_adapter *adap),
.tuner_attach(struct dvb_usb_adapter *adap),
.init(struct dvb_usb_device *d),
.get_rc(struct dvb_rc *),
.i2c_algo = (struct i2c_algorithm),
.frontend_ctrl(struct dvb_frontend *fe, int onoff),
.get_stream_props(struct usb_data_stream_properties *),
.streaming_ctrl(struct dvb_usb_adapter *adap, int onoff),
.generic_bulk_ctrl_endpoint = (int),
.generic_bulk_ctrl_endpoint_response = (int),
.devices = (struct dvb_usb_device)[],
};
struct dvb_usb_device dvb_usb_devices {
char *name = "name",
.rc_map = RC_MAP_EMPTY,
.device_id = (struct usb_device_id),
}
It is likely Wednesday I am going to start implementing that one unless
some big issues are raised. Making simple test code as a
proof-of-concept should not be very many days of work.
regards
Antti
--
http://palosaari.fi/
next reply other threads:[~2012-05-20 20:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-20 20:55 Antti Palosaari [this message]
2012-05-20 22:30 ` [RFCv1] DVB-USB improvements [alternative 2] VDR User
2012-05-20 23:10 ` Devin Heitmueller
2012-05-21 0:36 ` VDR User
2012-05-21 2:22 ` Antti Palosaari
2012-05-21 2:42 ` VDR User
2012-05-21 3:20 ` Antti Palosaari
2012-05-21 3:44 ` Mauro Carvalho Chehab
2012-05-21 3:50 ` Mauro Carvalho Chehab
2012-05-25 17:44 ` Antti Palosaari
2012-05-25 17:48 ` Antti Palosaari
2012-05-25 18:32 ` Mauro Carvalho Chehab
2012-05-25 18:38 ` Mauro Carvalho Chehab
2012-05-25 18:51 ` Antti Palosaari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FB95A3B.9070800@iki.fi \
--to=crope@iki.fi \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
--cc=pboettcher@kernellabs.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.