diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-10-20 00:10:27 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-10-20 00:10:27 -0300 |
commit | d0b2f91bede3bd5e3d24dd6803e56eee959c1797 (patch) | |
tree | 7fee4ab0509879c373c4f2cbd5b8a5be5b4041ee /drivers/media/dvb-core | |
parent | e914f8eb445e8f74b00303c19c2ffceaedd16a05 (diff) |
Linux-libre 4.8.2-gnupck-4.8.2-gnu
Diffstat (limited to 'drivers/media/dvb-core')
-rw-r--r-- | drivers/media/dvb-core/demux.h | 167 | ||||
-rw-r--r-- | drivers/media/dvb-core/dmxdev.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb-core/dvb_ca_en50221.c | 39 | ||||
-rw-r--r-- | drivers/media/dvb-core/dvb_demux.c | 17 | ||||
-rw-r--r-- | drivers/media/dvb-core/dvb_demux.h | 4 | ||||
-rw-r--r-- | drivers/media/dvb-core/dvb_frontend.c | 33 | ||||
-rw-r--r-- | drivers/media/dvb-core/dvb_frontend.h | 53 | ||||
-rw-r--r-- | drivers/media/dvb-core/dvb_math.h | 7 | ||||
-rw-r--r-- | drivers/media/dvb-core/dvb_net.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb-core/dvb_ringbuffer.h | 15 |
10 files changed, 156 insertions, 183 deletions
diff --git a/drivers/media/dvb-core/demux.h b/drivers/media/dvb-core/demux.h index 6d3b95b89..4b4c1da20 100644 --- a/drivers/media/dvb-core/demux.h +++ b/drivers/media/dvb-core/demux.h @@ -1,6 +1,10 @@ /* * demux.h * + * The Kernel Digital TV Demux kABI defines a driver-internal interface for + * registering low-level, hardware specific driver to a hardware independent + * demux layer. + * * Copyright (c) 2002 Convergence GmbH * * based on code: @@ -32,49 +36,6 @@ #include <linux/time.h> #include <linux/dvb/dmx.h> -/** - * DOC: Digital TV Demux - * - * The Kernel Digital TV Demux kABI defines a driver-internal interface for - * registering low-level, hardware specific driver to a hardware independent - * demux layer. It is only of interest for Digital TV device driver writers. - * The header file for this kABI is named demux.h and located in - * drivers/media/dvb-core. - * - * The demux kABI should be implemented for each demux in the system. It is - * used to select the TS source of a demux and to manage the demux resources. - * When the demux client allocates a resource via the demux kABI, it receives - * a pointer to the kABI of that resource. - * - * Each demux receives its TS input from a DVB front-end or from memory, as - * set via this demux kABI. In a system with more than one front-end, the kABI - * can be used to select one of the DVB front-ends as a TS source for a demux, - * unless this is fixed in the HW platform. - * - * The demux kABI only controls front-ends regarding to their connections with - * demuxes; the kABI used to set the other front-end parameters, such as - * tuning, are devined via the Digital TV Frontend kABI. - * - * The functions that implement the abstract interface demux should be defined - * static or module private and registered to the Demux core for external - * access. It is not necessary to implement every function in the struct - * &dmx_demux. For example, a demux interface might support Section filtering, - * but not PES filtering. The kABI client is expected to check the value of any - * function pointer before calling the function: the value of NULL means - * that the function is not available. - * - * Whenever the functions of the demux API modify shared data, the - * possibilities of lost update and race condition problems should be - * addressed, e.g. by protecting parts of code with mutexes. - * - * Note that functions called from a bottom half context must not sleep. - * Even a simple memory allocation without using %GFP_ATOMIC can result in a - * kernel thread being put to sleep if swapping is needed. For example, the - * Linux Kernel calls the functions of a network device interface from a - * bottom half context. Thus, if a demux kABI function is called from network - * device code, the function must not sleep. - */ - /* * Common definitions */ @@ -104,7 +65,7 @@ */ /** - * enum ts_filter_type - filter type bitmap for dmx_ts_feed.set() + * enum ts_filter_type - filter type bitmap for dmx_ts_feed.set\(\) * * @TS_PACKET: Send TS packets (188 bytes) to callback (default). * @TS_PAYLOAD_ONLY: In case TS_PACKET is set, only send the TS payload @@ -143,7 +104,7 @@ struct dmx_ts_feed { int type, enum dmx_ts_pes pes_type, size_t circular_buffer_size, - struct timespec timeout); + ktime_t timeout); int (*start_filtering)(struct dmx_ts_feed *feed); int (*stop_filtering)(struct dmx_ts_feed *feed); }; @@ -231,30 +192,6 @@ struct dmx_section_feed { }; /** - * DOC: Demux Callback - * - * This kernel-space API comprises the callback functions that deliver filtered - * data to the demux client. Unlike the other DVB kABIs, these functions are - * provided by the client and called from the demux code. - * - * The function pointers of this abstract interface are not packed into a - * structure as in the other demux APIs, because the callback functions are - * registered and used independent of each other. As an example, it is possible - * for the API client to provide several callback functions for receiving TS - * packets and no callbacks for PES packets or sections. - * - * The functions that implement the callback API need not be re-entrant: when - * a demux driver calls one of these functions, the driver is not allowed to - * call the function again before the original call returns. If a callback is - * triggered by a hardware interrupt, it is recommended to use the Linux - * bottom half mechanism or start a tasklet instead of making the callback - * function call directly from a hardware interrupt. - * - * This mechanism is implemented by dmx_ts_cb() and dmx_section_cb() - * callbacks. - */ - -/** * typedef dmx_ts_cb - DVB demux TS filter callback function prototype * * @buffer1: Pointer to the start of the filtered TS packets. @@ -402,7 +339,7 @@ struct dmx_frontend { * @DMX_SECTION_FILTERING: set if section filtering is supported; * @DMX_MEMORY_BASED_FILTERING: set if write() available. * - * Those flags are OR'ed in the &dmx_demux.&capabilities field + * Those flags are OR'ed in the &dmx_demux.capabilities field */ enum dmx_demux_caps { DMX_TS_FILTERING = 1, @@ -442,10 +379,10 @@ enum dmx_demux_caps { * @open is called and decrement it when @close is called. * The @demux function parameter contains a pointer to the demux API and * instance data. - * It returns - * 0 on success; - * -EUSERS, if maximum usage count was reached; - * -EINVAL, on bad parameter. + * It returns: + * 0 on success; + * -EUSERS, if maximum usage count was reached; + * -EINVAL, on bad parameter. * * @close: This function reserves the demux for use by the caller and, if * necessary, initializes the demux. When the demux is no longer needed, @@ -455,10 +392,10 @@ enum dmx_demux_caps { * @open is called and decrement it when @close is called. * The @demux function parameter contains a pointer to the demux API and * instance data. - * It returns - * 0 on success; - * -ENODEV, if demux was not in use (e. g. no users); - * -EINVAL, on bad parameter. + * It returns: + * 0 on success; + * -ENODEV, if demux was not in use (e. g. no users); + * -EINVAL, on bad parameter. * * @write: This function provides the demux driver with a memory buffer * containing TS packets. Instead of receiving TS packets from the DVB @@ -473,12 +410,12 @@ enum dmx_demux_caps { * The @buf function parameter contains a pointer to the TS data in * kernel-space memory. * The @count function parameter contains the length of the TS data. - * It returns - * 0 on success; - * -ERESTARTSYS, if mutex lock was interrupted; - * -EINTR, if a signal handling is pending; - * -ENODEV, if demux was removed; - * -EINVAL, on bad parameter. + * It returns: + * 0 on success; + * -ERESTARTSYS, if mutex lock was interrupted; + * -EINTR, if a signal handling is pending; + * -ENODEV, if demux was removed; + * -EINVAL, on bad parameter. * * @allocate_ts_feed: Allocates a new TS feed, which is used to filter the TS * packets carrying a certain PID. The TS feed normally corresponds to a @@ -489,11 +426,11 @@ enum dmx_demux_caps { * instance data. * The @callback function parameter contains a pointer to the callback * function for passing received TS packet. - * It returns - * 0 on success; - * -ERESTARTSYS, if mutex lock was interrupted; - * -EBUSY, if no more TS feeds is available; - * -EINVAL, on bad parameter. + * It returns: + * 0 on success; + * -ERESTARTSYS, if mutex lock was interrupted; + * -EBUSY, if no more TS feeds is available; + * -EINVAL, on bad parameter. * * @release_ts_feed: Releases the resources allocated with @allocate_ts_feed. * Any filtering in progress on the TS feed should be stopped before @@ -502,9 +439,9 @@ enum dmx_demux_caps { * instance data. * The @feed function parameter contains a pointer to the TS feed API and * instance data. - * It returns - * 0 on success; - * -EINVAL on bad parameter. + * It returns: + * 0 on success; + * -EINVAL on bad parameter. * * @allocate_section_feed: Allocates a new section feed, i.e. a demux resource * for filtering and receiving sections. On platforms with hardware @@ -520,10 +457,10 @@ enum dmx_demux_caps { * instance data. * The @callback function parameter contains a pointer to the callback * function for passing received TS packet. - * It returns - * 0 on success; - * -EBUSY, if no more TS feeds is available; - * -EINVAL, on bad parameter. + * It returns: + * 0 on success; + * -EBUSY, if no more TS feeds is available; + * -EINVAL, on bad parameter. * * @release_section_feed: Releases the resources allocated with * @allocate_section_feed, including allocated filters. Any filtering in @@ -533,9 +470,9 @@ enum dmx_demux_caps { * instance data. * The @feed function parameter contains a pointer to the TS feed API and * instance data. - * It returns - * 0 on success; - * -EINVAL, on bad parameter. + * It returns: + * 0 on success; + * -EINVAL, on bad parameter. * * @add_frontend: Registers a connectivity between a demux and a front-end, * i.e., indicates that the demux can be connected via a call to @@ -549,9 +486,9 @@ enum dmx_demux_caps { * instance data. * The @frontend function parameter contains a pointer to the front-end * instance data. - * It returns - * 0 on success; - * -EINVAL, on bad parameter. + * It returns: + * 0 on success; + * -EINVAL, on bad parameter. * * @remove_frontend: Indicates that the given front-end, registered by a call * to @add_frontend, can no longer be connected as a TS source by this @@ -565,10 +502,10 @@ enum dmx_demux_caps { * instance data. * The @frontend function parameter contains a pointer to the front-end * instance data. - * It returns - * 0 on success; - * -ENODEV, if the front-end was not found, - * -EINVAL, on bad parameter. + * It returns: + * 0 on success; + * -ENODEV, if the front-end was not found, + * -EINVAL, on bad parameter. * * @get_frontends: Provides the APIs of the front-ends that have been * registered for this demux. Any of the front-ends obtained with this @@ -592,17 +529,17 @@ enum dmx_demux_caps { * instance data. * The @frontend function parameter contains a pointer to the front-end * instance data. - * It returns - * 0 on success; - * -EINVAL, on bad parameter. + * It returns: + * 0 on success; + * -EINVAL, on bad parameter. * * @disconnect_frontend: Disconnects the demux and a front-end previously * connected by a @connect_frontend call. * The @demux function parameter contains a pointer to the demux API and * instance data. - * It returns - * 0 on success; - * -EINVAL on bad parameter. + * It returns: + * 0 on success; + * -EINVAL on bad parameter. * * @get_pes_pids: Get the PIDs for DMX_PES_AUDIO0, DMX_PES_VIDEO0, * DMX_PES_TELETEXT0, DMX_PES_SUBTITLE0 and DMX_PES_PCR0. @@ -610,9 +547,9 @@ enum dmx_demux_caps { * instance data. * The @pids function parameter contains an array with five u16 elements * where the PIDs will be stored. - * It returns - * 0 on success; - * -EINVAL on bad parameter. + * It returns: + * 0 on success; + * -EINVAL on bad parameter. */ struct dmx_demux { diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c index a168cbe1c..7b67e1dd9 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -556,7 +556,7 @@ static int dvb_dmxdev_start_feed(struct dmxdev *dmxdev, struct dmxdev_filter *filter, struct dmxdev_feed *feed) { - struct timespec timeout = { 0 }; + ktime_t timeout = ktime_set(0, 0); struct dmx_pes_filter_params *para = &filter->params.pes; dmx_output_t otype; int ret; diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c index f82cd1ff4..b5b5b195e 100644 --- a/drivers/media/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb-core/dvb_ca_en50221.c @@ -123,6 +123,7 @@ struct dvb_ca_slot { /* Private CA-interface information */ struct dvb_ca_private { + struct kref refcount; /* pointer back to the public data structure */ struct dvb_ca_en50221 *pub; @@ -161,6 +162,34 @@ struct dvb_ca_private { struct mutex ioctl_mutex; }; +static void dvb_ca_private_free(struct dvb_ca_private *ca) +{ + unsigned int i; + + dvb_unregister_device(ca->dvbdev); + for (i = 0; i < ca->slot_count; i++) + vfree(ca->slot_info[i].rx_buffer.data); + + kfree(ca->slot_info); + kfree(ca); +} + +static void dvb_ca_private_release(struct kref *ref) +{ + struct dvb_ca_private *ca = container_of(ref, struct dvb_ca_private, refcount); + dvb_ca_private_free(ca); +} + +static void dvb_ca_private_get(struct dvb_ca_private *ca) +{ + kref_get(&ca->refcount); +} + +static void dvb_ca_private_put(struct dvb_ca_private *ca) +{ + kref_put(&ca->refcount, dvb_ca_private_release); +} + static void dvb_ca_en50221_thread_wakeup(struct dvb_ca_private *ca); static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * ebuf, int ecount); static int dvb_ca_en50221_write_data(struct dvb_ca_private *ca, int slot, u8 * ebuf, int ecount); @@ -1558,6 +1587,8 @@ static int dvb_ca_en50221_io_open(struct inode *inode, struct file *file) dvb_ca_en50221_thread_update_delay(ca); dvb_ca_en50221_thread_wakeup(ca); + dvb_ca_private_get(ca); + return 0; } @@ -1586,6 +1617,8 @@ static int dvb_ca_en50221_io_release(struct inode *inode, struct file *file) module_put(ca->pub->owner); + dvb_ca_private_put(ca); + return err; } @@ -1681,6 +1714,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, ret = -ENOMEM; goto exit; } + kref_init(&ca->refcount); ca->pub = pubca; ca->flags = flags; ca->slot_count = slot_count; @@ -1759,10 +1793,7 @@ void dvb_ca_en50221_release(struct dvb_ca_en50221 *pubca) for (i = 0; i < ca->slot_count; i++) { dvb_ca_en50221_slot_shutdown(ca, i); - vfree(ca->slot_info[i].rx_buffer.data); } - kfree(ca->slot_info); - dvb_unregister_device(ca->dvbdev); - kfree(ca); + dvb_ca_private_put(ca); pubca->private = NULL; } diff --git a/drivers/media/dvb-core/dvb_demux.c b/drivers/media/dvb-core/dvb_demux.c index 0cc5e9351..a0cf7b0d0 100644 --- a/drivers/media/dvb-core/dvb_demux.c +++ b/drivers/media/dvb-core/dvb_demux.c @@ -398,28 +398,23 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) int dvr_done = 0; if (dvb_demux_speedcheck) { - struct timespec cur_time, delta_time; + ktime_t cur_time; u64 speed_bytes, speed_timedelta; demux->speed_pkts_cnt++; /* show speed every SPEED_PKTS_INTERVAL packets */ if (!(demux->speed_pkts_cnt % SPEED_PKTS_INTERVAL)) { - cur_time = current_kernel_time(); + cur_time = ktime_get(); - if (demux->speed_last_time.tv_sec != 0 && - demux->speed_last_time.tv_nsec != 0) { - delta_time = timespec_sub(cur_time, - demux->speed_last_time); + if (ktime_to_ns(demux->speed_last_time) != 0) { speed_bytes = (u64)demux->speed_pkts_cnt * 188 * 8; /* convert to 1024 basis */ speed_bytes = 1000 * div64_u64(speed_bytes, 1024); - speed_timedelta = - (u64)timespec_to_ns(&delta_time); - speed_timedelta = div64_u64(speed_timedelta, - 1000000); /* nsec -> usec */ + speed_timedelta = ktime_ms_delta(cur_time, + demux->speed_last_time); printk(KERN_INFO "TS speed %llu Kbits/sec \n", div64_u64(speed_bytes, speed_timedelta)); @@ -666,7 +661,7 @@ out: static int dmx_ts_feed_set(struct dmx_ts_feed *ts_feed, u16 pid, int ts_type, enum dmx_ts_pes pes_type, - size_t circular_buffer_size, struct timespec timeout) + size_t circular_buffer_size, ktime_t timeout) { struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; struct dvb_demux *demux = feed->demux; diff --git a/drivers/media/dvb-core/dvb_demux.h b/drivers/media/dvb-core/dvb_demux.h index ae7fc33c3..5ed3cab4a 100644 --- a/drivers/media/dvb-core/dvb_demux.h +++ b/drivers/media/dvb-core/dvb_demux.h @@ -83,7 +83,7 @@ struct dvb_demux_feed { u8 *buffer; int buffer_size; - struct timespec timeout; + ktime_t timeout; struct dvb_demux_filter *filter; int ts_type; @@ -134,7 +134,7 @@ struct dvb_demux { uint8_t *cnt_storage; /* for TS continuity check */ - struct timespec speed_last_time; /* for TS speed check */ + ktime_t speed_last_time; /* for TS speed check */ uint32_t speed_pkts_cnt; /* for TS speed check */ }; diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index c0142614c..be99c8dbc 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -99,6 +99,7 @@ MODULE_PARM_DESC(dvb_mfe_wait_time, "Wait up to <mfe_wait_time> seconds on open( static DEFINE_MUTEX(frontend_mutex); struct dvb_frontend_private { + struct kref refcount; /* thread/frontend values */ struct dvb_device *dvbdev; @@ -137,6 +138,23 @@ struct dvb_frontend_private { #endif }; +static void dvb_frontend_private_free(struct kref *ref) +{ + struct dvb_frontend_private *fepriv = + container_of(ref, struct dvb_frontend_private, refcount); + kfree(fepriv); +} + +static void dvb_frontend_private_put(struct dvb_frontend_private *fepriv) +{ + kref_put(&fepriv->refcount, dvb_frontend_private_free); +} + +static void dvb_frontend_private_get(struct dvb_frontend_private *fepriv) +{ + kref_get(&fepriv->refcount); +} + static void dvb_frontend_wakeup(struct dvb_frontend *fe); static int dtv_get_frontend(struct dvb_frontend *fe, struct dtv_frontend_properties *c, @@ -2543,6 +2561,8 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) fepriv->events.eventr = fepriv->events.eventw = 0; } + dvb_frontend_private_get(fepriv); + if (adapter->mfe_shared) mutex_unlock (&adapter->mfe_lock); return ret; @@ -2591,6 +2611,8 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) fe->ops.ts_bus_ctrl(fe, 0); } + dvb_frontend_private_put(fepriv); + return ret; } @@ -2679,6 +2701,8 @@ int dvb_register_frontend(struct dvb_adapter* dvb, } fepriv = fe->frontend_priv; + kref_init(&fepriv->refcount); + sema_init(&fepriv->sem, 1); init_waitqueue_head (&fepriv->wait_queue); init_waitqueue_head (&fepriv->events.wait_queue); @@ -2713,18 +2737,11 @@ int dvb_unregister_frontend(struct dvb_frontend* fe) mutex_lock(&frontend_mutex); dvb_frontend_stop (fe); - mutex_unlock(&frontend_mutex); - - if (fepriv->dvbdev->users < -1) - wait_event(fepriv->dvbdev->wait_queue, - fepriv->dvbdev->users==-1); - - mutex_lock(&frontend_mutex); dvb_unregister_device (fepriv->dvbdev); /* fe is invalid now */ - kfree(fepriv); mutex_unlock(&frontend_mutex); + dvb_frontend_private_put(fepriv); return 0; } EXPORT_SYMBOL(dvb_unregister_frontend); diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h index 9592573a0..fb6e84811 100644 --- a/drivers/media/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb-core/dvb_frontend.h @@ -1,6 +1,10 @@ /* * dvb_frontend.h * + * The Digital TV Frontend kABI defines a driver-internal interface for + * registering low-level, hardware specific driver to a hardware independent + * frontend layer. + * * Copyright (C) 2001 convergence integrated media GmbH * Copyright (C) 2004 convergence GmbH * @@ -42,29 +46,6 @@ #include "dvbdev.h" -/** - * DOC: Digital TV Frontend - * - * The Digital TV Frontend kABI defines a driver-internal interface for - * registering low-level, hardware specific driver to a hardware independent - * frontend layer. It is only of interest for Digital TV device driver writers. - * The header file for this API is named dvb_frontend.h and located in - * drivers/media/dvb-core. - * - * Before using the Digital TV frontend core, the bridge driver should attach - * the frontend demod, tuner and SEC devices and call dvb_register_frontend(), - * in order to register the new frontend at the subsystem. At device - * detach/removal, the bridge driver should call dvb_unregister_frontend() to - * remove the frontend from the core and then dvb_frontend_detach() to free the - * memory allocated by the frontend drivers. - * - * The drivers should also call dvb_frontend_suspend() as part of their - * handler for the &device_driver.suspend(), and dvb_frontend_resume() as - * part of their handler for &device_driver.resume(). - * - * A few other optional functions are provided to handle some special cases. - */ - /* * Maximum number of Delivery systems per frontend. It * should be smaller or equal to 32 @@ -406,7 +387,7 @@ struct dtv_frontend_properties; * FE_DISHNETWORK_SEND_LEGACY_CMD ioctl (only Satellite). * Drivers should not use this, except when the DVB * core emulation fails to provide proper support (e.g. - * if set_voltage() takes more than 8ms to work), and + * if @set_voltage takes more than 8ms to work), and * when backward compatibility with this legacy API is * required. * @i2c_gate_ctrl: controls the I2C gate. Newer drivers should use I2C @@ -741,13 +722,13 @@ void dvb_frontend_detach(struct dvb_frontend *fe); * This function prepares a Digital TV frontend to suspend. * * In order to prepare the tuner to suspend, if - * &dvb_frontend_ops.tuner_ops.suspend() is available, it calls it. Otherwise, - * it will call &dvb_frontend_ops.tuner_ops.sleep(), if available. + * &dvb_frontend_ops.tuner_ops.suspend\(\) is available, it calls it. Otherwise, + * it will call &dvb_frontend_ops.tuner_ops.sleep\(\), if available. * - * It will also call &dvb_frontend_ops.sleep() to put the demod to suspend. + * It will also call &dvb_frontend_ops.sleep\(\) to put the demod to suspend. * - * The drivers should also call dvb_frontend_suspend() as part of their - * handler for the &device_driver.suspend(). + * The drivers should also call dvb_frontend_suspend\(\) as part of their + * handler for the &device_driver.suspend\(\). */ int dvb_frontend_suspend(struct dvb_frontend *fe); @@ -758,17 +739,17 @@ int dvb_frontend_suspend(struct dvb_frontend *fe); * * This function resumes the usual operation of the tuner after resume. * - * In order to resume the frontend, it calls the demod &dvb_frontend_ops.init(). + * In order to resume the frontend, it calls the demod &dvb_frontend_ops.init\(\). * - * If &dvb_frontend_ops.tuner_ops.resume() is available, It, it calls it. - * Otherwise,t will call &dvb_frontend_ops.tuner_ops.init(), if available. + * If &dvb_frontend_ops.tuner_ops.resume\(\) is available, It, it calls it. + * Otherwise,t will call &dvb_frontend_ops.tuner_ops.init\(\), if available. * * Once tuner and demods are resumed, it will enforce that the SEC voltage and * tone are restored to their previous values and wake up the frontend's * kthread in order to retune the frontend. * * The drivers should also call dvb_frontend_resume() as part of their - * handler for the &device_driver.resume(). + * handler for the &device_driver.resume\(\). */ int dvb_frontend_resume(struct dvb_frontend *fe); @@ -777,7 +758,7 @@ int dvb_frontend_resume(struct dvb_frontend *fe); * * @fe: pointer to the frontend struct * - * Calls &dvb_frontend_ops.init() and &dvb_frontend_ops.tuner_ops.init(), + * Calls &dvb_frontend_ops.init\(\) and &dvb_frontend_ops.tuner_ops.init\(\), * and resets SEC tone and voltage (for Satellite systems). * * NOTE: Currently, this function is used only by one driver (budget-av). @@ -799,14 +780,14 @@ void dvb_frontend_reinitialise(struct dvb_frontend *fe); * satellite subsystem. * * Its used internally by the DVB frontend core, in order to emulate - * %FE_DISHNETWORK_SEND_LEGACY_CMD using the &dvb_frontend_ops.set_voltage() + * %FE_DISHNETWORK_SEND_LEGACY_CMD using the &dvb_frontend_ops.set_voltage\(\) * callback. * * NOTE: it should not be used at the drivers, as the emulation for the * legacy callback is provided by the Kernel. The only situation where this * should be at the drivers is when there are some bugs at the hardware that * would prevent the core emulation to work. On such cases, the driver would - * be writing a &dvb_frontend_ops.dishnetwork_send_legacy_command() and + * be writing a &dvb_frontend_ops.dishnetwork_send_legacy_command\(\) and * calling this function directly. */ void dvb_frontend_sleep_until(ktime_t *waketime, u32 add_usec); diff --git a/drivers/media/dvb-core/dvb_math.h b/drivers/media/dvb-core/dvb_math.h index 34dc1df03..2f0326674 100644 --- a/drivers/media/dvb-core/dvb_math.h +++ b/drivers/media/dvb-core/dvb_math.h @@ -30,11 +30,15 @@ * @value: The value (must be != 0) * * to use rational values you can use the following method: + * * intlog2(value) = intlog2(value * 2^x) - x * 2^24 * * Some usecase examples: + * * intlog2(8) will give 3 << 24 = 3 * 2^24 + * * intlog2(9) will give 3 << 24 + ... = 3.16... * 2^24 + * * intlog2(1.5) = intlog2(3) - 2^24 = 0.584... * 2^24 * * @@ -48,10 +52,13 @@ extern unsigned int intlog2(u32 value); * @value: The value (must be != 0) * * to use rational values you can use the following method: + * * intlog10(value) = intlog10(value * 10^x) - x * 2^24 * * An usecase example: + * * intlog10(1000) will give 3 << 24 = 3 * 2^24 + * * due to the implementation intlog10(1000) might be not exactly 3 * 2^24 * * look at intlog2 for similar examples diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c index ce6a711b4..9914f69a4 100644 --- a/drivers/media/dvb-core/dvb_net.c +++ b/drivers/media/dvb-core/dvb_net.c @@ -997,7 +997,7 @@ static int dvb_net_feed_start(struct net_device *dev) netdev_dbg(dev, "start filtering\n"); priv->secfeed->start_filtering(priv->secfeed); } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) { - struct timespec timeout = { 0, 10000000 }; // 10 msec + ktime_t timeout = ns_to_ktime(10 * NSEC_PER_MSEC); /* we have payloads encapsulated in TS */ netdev_dbg(dev, "alloc tsfeed\n"); diff --git a/drivers/media/dvb-core/dvb_ringbuffer.h b/drivers/media/dvb-core/dvb_ringbuffer.h index 3ebc2d34b..8af642399 100644 --- a/drivers/media/dvb-core/dvb_ringbuffer.h +++ b/drivers/media/dvb-core/dvb_ringbuffer.h @@ -150,9 +150,6 @@ extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, /** * dvb_ringbuffer_pkt_read_user - Read from a packet in the ringbuffer. - * Note: unlike dvb_ringbuffer_read(), this does NOT update the read pointer - * in the ringbuffer. You must use dvb_ringbuffer_pkt_dispose() to mark a - * packet as no longer required. * * @rbuf: Ringbuffer concerned. * @idx: Packet index as returned by dvb_ringbuffer_pkt_next(). @@ -161,9 +158,17 @@ extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, * @len: Size of destination buffer. * * returns Number of bytes read, or -EFAULT. + * + * .. note:: + * + * unlike dvb_ringbuffer_read(), this does **NOT** update the read pointer + * in the ringbuffer. You must use dvb_ringbuffer_pkt_dispose() to mark a + * packet as no longer required. */ -extern ssize_t dvb_ringbuffer_pkt_read_user(struct dvb_ringbuffer *rbuf, size_t idx, - int offset, u8 __user *buf, size_t len); +extern ssize_t dvb_ringbuffer_pkt_read_user(struct dvb_ringbuffer *rbuf, + size_t idx, + int offset, u8 __user *buf, + size_t len); /** * dvb_ringbuffer_pkt_read - Read from a packet in the ringbuffer. |