Reserve 4 adapter numbers for each DVB-C modulators

In order to determine on which tab/port modules are plugged, udev
relies on adapter numbers which must remain multiple of 4.
This commit is contained in:
Florent Audebert
2015-05-13 17:51:23 +02:00
committed by Richard Bérichon
parent 53dc0b8905
commit 5ae225b1f6
3 changed files with 17 additions and 8 deletions

View File

@@ -780,9 +780,10 @@ static int dvbdev_check_free_adapter_num(int num)
list_for_each(entry, &dvb_adapter_list) {
struct dvb_adapter *adap;
adap = list_entry(entry, struct dvb_adapter, list_head);
if (adap->num == num)
if (num >= adap->num && num < adap->num + adap->num_reserved)
return 0;
}
return 1;
}
@@ -802,7 +803,7 @@ static int dvbdev_get_free_adapter_num (void)
int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
struct module *module, struct device *device,
short *adapter_nums)
short *adapter_nums, int num_reserved)
{
int i, num;
@@ -837,6 +838,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
adap->device = device;
adap->mfe_shared = 0;
adap->mfe_dvbdev = NULL;
adap->num_reserved = num_reserved;
mutex_init (&adap->mfe_lock);
list_add_tail (&adap->list_head, &dvb_adapter_list);

View File

@@ -95,6 +95,8 @@ struct dvb_adapter {
struct dvb_device *mfe_dvbdev; /* frontend device in use */
struct mutex mfe_lock; /* access lock for thread creation */
int num_reserved;
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
struct media_device *mdev;
struct media_entity *conn;
@@ -181,7 +183,7 @@ struct dvb_device {
*/
int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
struct module *module, struct device *device,
short *adapter_nums);
short *adapter_nums, int num_reserved);
/**
* dvb_unregister_adapter - Unregisters a DVB adapter