static bool has_get_frontend(struct dvb_frontend *fe)
{
- return fe->ops.get_frontend != NULL;
+ return fe->ops.get_frontend;
}
/*
mutex_unlock(&events->mtx);
- wake_up_interruptible (&events->wait_queue);
+ wake_up_interruptible(&events->wait_queue);
}
static int dvb_frontend_test_event(struct dvb_frontend_private *fepriv,
}
static int dvb_frontend_get_event(struct dvb_frontend *fe,
- struct dvb_frontend_event *event, int flags)
+ struct dvb_frontend_event *event, int flags)
{
struct dvb_frontend_private *fepriv = fe->frontend_priv;
struct dvb_fe_events *events = &fepriv->events;
static void dvb_frontend_init(struct dvb_frontend *fe)
{
dev_dbg(fe->dvb->device,
- "%s: initialising adapter %i frontend %i (%s)...\n",
- __func__, fe->dvb->num, fe->id, fe->ops.info.name);
+ "%s: initialising adapter %i frontend %i (%s)...\n",
+ __func__, fe->dvb->num, fe->id, fe->ops.info.name);
if (fe->ops.init)
fe->ops.init(fe);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
if (locked)
- (fepriv->quality) = (fepriv->quality * 220 + 36*256) / 256;
+ (fepriv->quality) = (fepriv->quality * 220 + 36 * 256) / 256;
else
(fepriv->quality) = (fepriv->quality * 220 + 0) / 256;
q2 = fepriv->quality - 128;
q2 *= q2;
- fepriv->delay = fepriv->min_delay + q2 * HZ / (128*128);
+ fepriv->delay = fepriv->min_delay + q2 * HZ / (128 * 128);
}
/**
(c->inversion == INVERSION_AUTO));
/* setup parameters correctly */
- while(!ready) {
+ while (!ready) {
/* calculate the lnb_drift */
fepriv->lnb_drift = fepriv->auto_step * fepriv->step_size;
}
/* perform inversion and +/- zigzag */
- switch(fepriv->auto_sub_step) {
+ switch (fepriv->auto_sub_step) {
case 0:
/* try with the current inversion and current drift setting */
ready = 1;
return 1;
}
- dev_dbg(fe->dvb->device, "%s: drift:%i inversion:%i auto_step:%i " \
- "auto_sub_step:%i started_auto_step:%i\n",
- __func__, fepriv->lnb_drift, fepriv->inversion,
- fepriv->auto_step, fepriv->auto_sub_step,
- fepriv->started_auto_step);
+ dev_dbg(fe->dvb->device,
+ "%s: drift:%i inversion:%i auto_step:%i auto_sub_step:%i started_auto_step:%i\n",
+ __func__, fepriv->lnb_drift, fepriv->inversion,
+ fepriv->auto_step, fepriv->auto_sub_step,
+ fepriv->started_auto_step);
/* set the frontend itself */
c->frequency += fepriv->lnb_drift;
/* if we've got no parameters, just keep idling */
if (fepriv->state & FESTATE_IDLE) {
- fepriv->delay = 3*HZ;
+ fepriv->delay = 3 * HZ;
fepriv->quality = 0;
return;
}
else
fepriv->state = FESTATE_TUNED;
}
- fepriv->delay = 3*HZ;
+ fepriv->delay = 3 * HZ;
fepriv->quality = 0;
return;
}
}
fepriv->check_wrapped = 1;
- /* if we've just retuned, enter the ZIGZAG_FAST state.
+ /* if we've just re-tuned, enter the ZIGZAG_FAST state.
* This ensures we cannot return from an
* FE_SET_FRONTEND ioctl before the first frontend tune
* occurs */
fepriv->check_wrapped = 0;
fepriv->quality = 0;
- fepriv->delay = 3*HZ;
+ fepriv->delay = 3 * HZ;
fepriv->status = 0;
fepriv->wakeup = 0;
fepriv->reinitialise = 0;
up(&fepriv->sem); /* is locked when we enter the thread... */
restart:
wait_event_interruptible_timeout(fepriv->wait_queue,
- dvb_frontend_should_wakeup(fe) || kthread_should_stop()
- || freezing(current),
+ dvb_frontend_should_wakeup(fe) ||
+ kthread_should_stop() ||
+ freezing(current),
fepriv->delay);
if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) {
/* paranoia check in case a signal arrived */
if (fepriv->thread)
dev_warn(fe->dvb->device,
- "dvb_frontend_stop: warning: thread %p won't exit\n",
- fepriv->thread);
+ "dvb_frontend_stop: warning: thread %p won't exit\n",
+ fepriv->thread);
}
/*
if (fe->exit == DVB_FE_NO_EXIT)
return 0;
else
- dvb_frontend_stop (fe);
+ dvb_frontend_stop(fe);
}
if (signal_pending(current))
return -EINTR;
- if (down_interruptible (&fepriv->sem))
+ if (down_interruptible(&fepriv->sem))
return -EINTR;
fepriv->state = FESTATE_IDLE;
mb();
fe_thread = kthread_run(dvb_frontend_thread, fe,
- "kdvb-ad-%i-fe-%i", fe->dvb->num,fe->id);
+ "kdvb-ad-%i-fe-%i", fe->dvb->num, fe->id);
if (IS_ERR(fe_thread)) {
ret = PTR_ERR(fe_thread);
dev_warn(fe->dvb->device,
- "dvb_frontend_start: failed to start kthread (%d)\n",
- ret);
+ "dvb_frontend_start: failed to start kthread (%d)\n",
+ ret);
up(&fepriv->sem);
return ret;
}
}
static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe,
- u32 *freq_min, u32 *freq_max)
+ u32 *freq_min, u32 *freq_max)
{
*freq_min = max(fe->ops.info.frequency_min, fe->ops.tuner_ops.info.frequency_min);
*freq_max = min(fe->ops.info.frequency_max, fe->ops.tuner_ops.info.frequency_max);
if (*freq_min == 0 || *freq_max == 0)
- dev_warn(fe->dvb->device, "DVB: adapter %i frontend %u frequency limits undefined - fix the driver\n",
- fe->dvb->num, fe->id);
+ dev_warn(fe->dvb->device,
+ "DVB: adapter %i frontend %u frequency limits undefined - fix the driver\n",
+ fe->dvb->num, fe->id);
}
static int dvb_frontend_check_parameters(struct dvb_frontend *fe)
if ((freq_min && c->frequency < freq_min) ||
(freq_max && c->frequency > freq_max)) {
dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n",
- fe->dvb->num, fe->id, c->frequency,
- freq_min, freq_max);
+ fe->dvb->num, fe->id, c->frequency,
+ freq_min, freq_max);
return -EINVAL;
}
(fe->ops.info.symbol_rate_max &&
c->symbol_rate > fe->ops.info.symbol_rate_max)) {
dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n",
- fe->dvb->num, fe->id, c->symbol_rate,
- fe->ops.info.symbol_rate_min,
- fe->ops.info.symbol_rate_max);
+ fe->dvb->num, fe->id, c->symbol_rate,
+ fe->ops.info.symbol_rate_min,
+ fe->ops.info.symbol_rate_max);
return -EINVAL;
}
default:
c->delivery_system = delsys;
dev_dbg(fe->dvb->device, "%s: Clearing cache for delivery system %d\n",
- __func__, c->delivery_system);
+ __func__, c->delivery_system);
c->transmission_mode = TRANSMISSION_MODE_AUTO;
c->bandwidth_hz = 0; /* AUTO */
break;
case DVBV3_UNKNOWN:
dev_err(fe->dvb->device,
- "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
- __func__, c->delivery_system);
+ "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
+ __func__, c->delivery_system);
return -EINVAL;
}
switch (dvbv3_type(c->delivery_system)) {
case DVBV3_UNKNOWN:
dev_err(fe->dvb->device,
- "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
- __func__, c->delivery_system);
+ "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
+ __func__, c->delivery_system);
return -EINVAL;
case DVBV3_QPSK:
dev_dbg(fe->dvb->device, "%s: Preparing QPSK req\n", __func__);
{
int ncaps;
- switch(tvp->cmd) {
+ switch (tvp->cmd) {
case DTV_ENUM_DELSYS:
ncaps = 0;
while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) {
if (fe->ops.delsys[ncaps] == desired_system) {
c->delivery_system = desired_system;
dev_dbg(fe->dvb->device,
- "%s: Changing delivery system to %d\n",
- __func__, desired_system);
+ "%s: Changing delivery system to %d\n",
+ __func__, desired_system);
return 0;
}
ncaps++;
*/
if (is_dvbv3_delsys(c->delivery_system)) {
dev_dbg(fe->dvb->device,
- "%s: Using delivery system to %d\n",
- __func__, c->delivery_system);
+ "%s: Using delivery system to %d\n",
+ __func__, c->delivery_system);
return 0;
}
* Zero on success, negative errno on failure.
*/
static int dtv_property_process_set(struct dvb_frontend *fe,
- struct file *file,
- u32 cmd, u32 data)
+ struct file *file,
+ u32 cmd, u32 data)
{
int r = 0;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
/** Dump DTV command name and value*/
if (!cmd || cmd > DTV_MAX_COMMAND)
dev_warn(fe->dvb->device, "%s: SET cmd 0x%08x undefined\n",
- __func__, cmd);
+ __func__, cmd);
else
dev_dbg(fe->dvb->device,
- "%s: SET cmd 0x%08x (%s) to 0x%08x\n",
- __func__, cmd, dtv_cmds[cmd].name, data);
+ "%s: SET cmd 0x%08x (%s) to 0x%08x\n",
+ __func__, cmd, dtv_cmds[cmd].name, data);
switch (cmd) {
case DTV_CLEAR:
/*
case DTV_VOLTAGE:
c->voltage = data;
r = dvb_frontend_handle_ioctl(file, FE_SET_VOLTAGE,
- (void *)c->voltage);
+ (void *)c->voltage);
break;
case DTV_TONE:
c->sectone = data;
r = dvb_frontend_handle_ioctl(file, FE_SET_TONE,
- (void *)c->sectone);
+ (void *)c->sectone);
break;
case DTV_CODE_RATE_HP:
c->code_rate_HP = data;
for (i = 0; i < tvps->num; i++) {
err = dtv_property_process_set(fe, file,
- (tvp + i)->cmd,
- (tvp + i)->u.data);
+ (tvp + i)->cmd,
+ (tvp + i)->u.data);
if (err < 0) {
kfree(tvp);
return err;
return 0;
}
-
static int dvb_frontend_handle_ioctl(struct file *file,
unsigned int cmd, void *parg)
{
for (i = 0; i < tvps->num; i++) {
err = dtv_property_process_set(fe, file,
- (tvp + i)->cmd,
- (tvp + i)->u.data);
+ (tvp + i)->cmd,
+ (tvp + i)->u.data);
if (err < 0) {
kfree(tvp);
return err;
}
case FE_GET_INFO: {
- struct dvb_frontend_info* info = parg;
+ struct dvb_frontend_info *info = parg;
memcpy(info, &fe->ops.info, sizeof(struct dvb_frontend_info));
dvb_frontend_get_frequency_limits(fe, &info->frequency_min, &info->frequency_max);
break;
default:
dev_err(fe->dvb->device,
- "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
- __func__, c->delivery_system);
+ "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
+ __func__, c->delivery_system);
fe->ops.info.type = FE_OFDM;
}
dev_dbg(fe->dvb->device, "%s: current delivery system on cache: %d, V3 type: %d\n",
- __func__, c->delivery_system, fe->ops.info.type);
+ __func__, c->delivery_system, fe->ops.info.type);
/* Set CAN_INVERSION_AUTO bit on in other than oneshot mode */
if (!(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT))
* that user get signal state from previous tuning */
if (fepriv->state == FESTATE_RETUNE ||
fepriv->state == FESTATE_ERROR) {
- err=0;
+ err = 0;
*status = 0;
break;
}
case FE_ENABLE_HIGH_LNB_VOLTAGE:
if (fe->ops.enable_high_lnb_voltage)
- err = fe->ops.enable_high_lnb_voltage(fe, (long) parg);
+ err = fe->ops.enable_high_lnb_voltage(fe, (long)parg);
break;
case FE_SET_FRONTEND_TUNE_MODE:
- fepriv->tune_mode_flags = (unsigned long) parg;
+ fepriv->tune_mode_flags = (unsigned long)parg;
err = 0;
break;
* initialization, so parg is 8 bits and does not
* include the initialization or start bit
*/
- unsigned long swcmd = ((unsigned long) parg) << 1;
+ unsigned long swcmd = ((unsigned long)parg) << 1;
ktime_t nexttime;
ktime_t tv[10];
int i;
u8 last = 1;
+
if (dvb_frontend_debug)
dprintk("%s switch command: 0x%04lx\n",
__func__, swcmd);
for (i = 0; i < 9; i++) {
if (dvb_frontend_debug)
- tv[i+1] = ktime_get_boottime();
+ tv[i + 1] = ktime_get_boottime();
if ((swcmd & 0x01) != last) {
/* set voltage to (last ? 13V : 18V) */
fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18);
__func__, fe->dvb->num);
for (i = 1; i < 10; i++)
pr_info("%d: %d\n", i,
- (int) ktime_us_delta(tv[i], tv[i-1]));
+ (int)ktime_us_delta(tv[i], tv[i - 1]));
}
err = 0;
fepriv->state = FESTATE_DISEQC;
err = dtv_set_frontend(fe);
break;
case FE_GET_EVENT:
- err = dvb_frontend_get_event (fe, parg, file->f_flags);
+ err = dvb_frontend_get_event(fe, parg, file->f_flags);
break;
case FE_GET_FRONTEND: {
return err;
}
-
static __poll_t dvb_frontend_poll(struct file *file, struct poll_table_struct *wait)
{
struct dvb_device *dvbdev = file->private_data;
dev_dbg_ratelimited(fe->dvb->device, "%s:\n", __func__);
- poll_wait (file, &fepriv->events.wait_queue, wait);
+ poll_wait(file, &fepriv->events.wait_queue, wait);
if (fepriv->events.eventw != fepriv->events.eventr)
return (EPOLLIN | EPOLLRDNORM | EPOLLPRI);
return -ENODEV;
if (adapter->mfe_shared) {
- mutex_lock (&adapter->mfe_lock);
+ mutex_lock(&adapter->mfe_lock);
- if (adapter->mfe_dvbdev == NULL)
+ if (!adapter->mfe_dvbdev)
adapter->mfe_dvbdev = dvbdev;
else if (adapter->mfe_dvbdev != dvbdev) {
*mfepriv = mfe->frontend_priv;
int mferetry = (dvb_mfe_wait_time << 1);
- mutex_unlock (&adapter->mfe_lock);
+ mutex_unlock(&adapter->mfe_lock);
while (mferetry-- && (mfedev->users != -1 ||
- mfepriv->thread != NULL)) {
- if(msleep_interruptible(500)) {
- if(signal_pending(current))
+ mfepriv->thread)) {
+ if (msleep_interruptible(500)) {
+ if (signal_pending(current))
return -EINTR;
}
}
- mutex_lock (&adapter->mfe_lock);
- if(adapter->mfe_dvbdev != dvbdev) {
+ mutex_lock(&adapter->mfe_lock);
+ if (adapter->mfe_dvbdev != dvbdev) {
mfedev = adapter->mfe_dvbdev;
mfe = mfedev->priv;
mfepriv = mfe->frontend_priv;
if (mfedev->users != -1 ||
- mfepriv->thread != NULL) {
- mutex_unlock (&adapter->mfe_lock);
+ mfepriv->thread) {
+ mutex_unlock(&adapter->mfe_lock);
return -EBUSY;
}
adapter->mfe_dvbdev = dvbdev;
fepriv->reinitialise = 1;
}
- if ((ret = dvb_generic_open (inode, file)) < 0)
+ if ((ret = dvb_generic_open(inode, file)) < 0)
goto err1;
if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
}
mutex_unlock(&fe->dvb->mdev_lock);
#endif
- ret = dvb_frontend_start (fe);
+ ret = dvb_frontend_start(fe);
if (ret)
goto err3;
dvb_frontend_get(fe);
if (adapter->mfe_shared)
- mutex_unlock (&adapter->mfe_lock);
+ mutex_unlock(&adapter->mfe_lock);
return ret;
err3:
fe->ops.ts_bus_ctrl(fe, 0);
err0:
if (adapter->mfe_shared)
- mutex_unlock (&adapter->mfe_lock);
+ mutex_unlock(&adapter->mfe_lock);
return ret;
}
mb();
}
- ret = dvb_generic_release (inode, file);
+ ret = dvb_generic_release(inode, file);
if (dvbdev->users == -1) {
wake_up(&fepriv->wait_queue);
int ret = 0;
dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num,
- fe->id);
+ fe->id);
if (fe->ops.tuner_ops.suspend)
ret = fe->ops.tuner_ops.suspend(fe);
int ret = 0;
dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num,
- fe->id);
+ fe->id);
fe->exit = DVB_FE_DEVICE_RESUME;
if (fe->ops.init)
}
EXPORT_SYMBOL(dvb_frontend_resume);
-int dvb_register_frontend(struct dvb_adapter* dvb,
- struct dvb_frontend* fe)
+int dvb_register_frontend(struct dvb_adapter *dvb,
+ struct dvb_frontend *fe)
{
struct dvb_frontend_private *fepriv;
const struct dvb_device dvbdev_template = {
.users = ~0,
.writers = 1,
- .readers = (~0)-1,
+ .readers = (~0) - 1,
.fops = &dvb_frontend_fops,
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
.name = fe->ops.info.name,
return -ERESTARTSYS;
fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL);
- if (fe->frontend_priv == NULL) {
+ if (!fe->frontend_priv) {
mutex_unlock(&frontend_mutex);
return -ENOMEM;
}
dvb_frontend_get(fe);
sema_init(&fepriv->sem, 1);
- init_waitqueue_head (&fepriv->wait_queue);
- init_waitqueue_head (&fepriv->events.wait_queue);
+ init_waitqueue_head(&fepriv->wait_queue);
+ init_waitqueue_head(&fepriv->events.wait_queue);
mutex_init(&fepriv->events.mtx);
fe->dvb = dvb;
fepriv->inversion = INVERSION_OFF;
dev_info(fe->dvb->device,
- "DVB: registering adapter %i frontend %i (%s)...\n",
- fe->dvb->num, fe->id, fe->ops.info.name);
+ "DVB: registering adapter %i frontend %i (%s)...\n",
+ fe->dvb->num, fe->id, fe->ops.info.name);
- dvb_register_device (fe->dvb, &fepriv->dvbdev, &dvbdev_template,
- fe, DVB_DEVICE_FRONTEND, 0);
+ dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template,
+ fe, DVB_DEVICE_FRONTEND, 0);
/*
* Initialize the cache to the proper values according with the
}
EXPORT_SYMBOL(dvb_register_frontend);
-int dvb_unregister_frontend(struct dvb_frontend* fe)
+int dvb_unregister_frontend(struct dvb_frontend *fe)
{
struct dvb_frontend_private *fepriv = fe->frontend_priv;
+
dev_dbg(fe->dvb->device, "%s:\n", __func__);
mutex_lock(&frontend_mutex);
}
}
-void dvb_frontend_detach(struct dvb_frontend* fe)
+void dvb_frontend_detach(struct dvb_frontend *fe)
{
dvb_frontend_invoke_release(fe, fe->ops.release_sec);
dvb_frontend_invoke_release(fe, fe->ops.tuner_ops.release);