From: Antti Palosaari Date: Sat, 16 Jun 2012 00:17:04 +0000 (-0300) Subject: [media] dvb_usb_v2: .read_mac_address() callback changes X-Git-Tag: firefly_0821_release~3680^2~275^2~1641 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ddee56943ab6df098e411fe943c2a52063fba0a5;p=firefly-linux-kernel-4.4.55.git [media] dvb_usb_v2: .read_mac_address() callback changes Give DVB adapter as a parameter for callback. MAC address is adapter property and it could be (at least in theory) there is devices having multiple adapters and all has own MAC. Also add error handling. If callback fails error is returned which leads device unregister. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/dvb-usb/dvb_usb.h b/drivers/media/dvb/dvb-usb/dvb_usb.h index 6392fd3d4164..e7015ce5b3b4 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb.h +++ b/drivers/media/dvb/dvb-usb/dvb_usb.h @@ -181,7 +181,7 @@ struct dvb_usb_device_properties { int (*power_ctrl) (struct dvb_usb_device *, int); int (*read_config) (struct dvb_usb_device *d); - int (*read_mac_address) (struct dvb_usb_device *, u8 []); + int (*read_mac_address) (struct dvb_usb_adapter *, u8 []); int (*frontend_attach) (struct dvb_usb_adapter *); int (*tuner_attach) (struct dvb_usb_adapter *); int (*frontend_ctrl) (struct dvb_frontend *, int); diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c b/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c index bc94874039e8..3cbae02ea51e 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c @@ -203,22 +203,21 @@ int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap) ret); goto err; } + adap->dvb_adap.priv = adap; if (adap->dev->props->read_mac_address) { - if (adap->dev->props->read_mac_address(adap->dev, - adap->dvb_adap.proposed_mac) == 0) - pr_info("%s: MAC address: %pM\n", KBUILD_MODNAME, - adap->dvb_adap.proposed_mac); - else - pr_err("%s: MAC address reading failed\n", - KBUILD_MODNAME); - } + ret = adap->dev->props->read_mac_address(adap, + adap->dvb_adap.proposed_mac); + if (ret < 0) + goto err_dmx; + pr_info("%s: MAC address: %pM\n", KBUILD_MODNAME, + adap->dvb_adap.proposed_mac); + } adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; adap->demux.priv = adap; - adap->demux.filternum = 0; if (adap->demux.filternum < adap->max_feed_count) adap->demux.filternum = adap->max_feed_count;