From: "Michael Büsch" <m@bues.ch>
To: "Hans-Frieder Vogt" <hfvogt@gmx.net>
Cc: linux-media@vger.kernel.org, Mauro Carvalho Chehab <mchehab@redhat.com>
Subject: Re: [PATCH] v0.3 Support for tuner FC0012
Date: Tue, 20 Mar 2012 23:33:12 +0100 [thread overview]
Message-ID: <20120320233312.2a204746@milhouse> (raw)
In-Reply-To: <201203202314.35920.hfvogt@gmx.net>
[-- Attachment #1: Type: text/plain, Size: 3514 bytes --]
On Tue, 20 Mar 2012 23:14:35 +0100
"Hans-Frieder Vogt" <hfvogt@gmx.net> wrote:
> +/*
> + buf[0] is the first register address
> + */
Just for me to understand this:
How does this work? Does the hardware auto-increment the register address
automatically after each received byte? If so, we could probably document
that here in the comment.
> +static int fc0012_writeregs(struct fc0012_priv *priv, u8 *buf, int len)
> +{
> + struct i2c_msg msg = {
> + .addr = priv->addr, .flags = 0, .buf = buf, .len = len
> + };
> +
> + if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
> + err("I2C write regs failed, reg: %02x, val[0]: %02x",
> + buf[0], len > 1 ? buf[1] : 0);
> + return -EREMOTEIO;
> + }
> + return 0;
> +}
> +static int fc0012_set_params(struct dvb_frontend *fe)
> +{
> +
> + priv->frequency = freq;
I think this either needs a freq*1000, or priv->frequency=p->frequency.
> + priv->bandwidth = p->bandwidth_hz;
> +
> +error_out:
> + return ret;
> +}
> +static const struct dvb_tuner_ops fc0012_tuner_ops = {
> + .info = {
> + .name = "Fitipower FC0012",
> +
> + .frequency_min = 170000000,
> + .frequency_max = 860000000,
> + .frequency_step = 0,
> + },
> +
> + .release = fc0012_release,
> +
> + .init = fc0012_init,
> + .sleep = fc0012_sleep,
> +
> + .set_params = fc0012_set_params,
> +
> + .get_frequency = fc0012_get_frequency,
> + .get_if_frequency = fc0012_get_if_frequency,
> + .get_bandwidth = fc0012_get_bandwidth,
> +};
> +
> +struct dvb_frontend * fc0012_attach(struct dvb_frontend *fe,
> + struct i2c_adapter *i2c, u8 i2c_address,
> + enum fc0012_xtal_freq xtal_freq)
> +{
> + struct fc0012_priv *priv = NULL;
Should use tab indention here and in the tuner_ops struct above.
> +
> +#ifndef _FC0012_H_
> +#define _FC0012_H_
> +
> +#include "dvb_frontend.h"
> +
> +enum fc0012_xtal_freq {
> + FC_XTAL_27_MHZ, /* 27000000 */
> + FC_XTAL_28_8_MHZ, /* 28800000 */
> + FC_XTAL_36_MHZ, /* 36000000 */
> +};
> +
> +#if defined(CONFIG_MEDIA_TUNER_FC0012) || \
> + (defined(CONFIG_MEDIA_TUNER_FC0012_MODULE) && defined(MODULE))
Why check for defined(MODULE) here?
> +extern struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
> + struct i2c_adapter *i2c,
> + u8 i2c_address,
> + enum fc0012_xtal_freq xtal_freq);
> +#else
> +#define LOG_PREFIX "fc0012"
> +
> +#define dprintk(var, level, args...) \
> + do { \
> + if ((var & level)) \
> + printk(args); \
> + } while (0)
> +
> +#define deb_info(args...) dprintk(fc0012_debug, 0x01, args)
> +
> +#undef err
> +#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
> +#undef info
> +#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
> +#undef warn
> +#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
I think you should get rid of all these custom print helpers and use dev_err,
dev_info and friends. Those are more ideomatic.
> +struct fc0012_priv {
> + struct i2c_adapter *i2c;
> + u8 addr;
> + u8 xtal_freq;
> +
> + u32 frequency;
> + u32 bandwidth;
> +};
Here seems to be some whitespace mixing. tab indention vs. space indention.
--
Greetings, Michael.
PGP encryption is encouraged / 908D8B0E
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-03-20 22:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-22 22:21 [PATCH 1/3] Support for tuner FC0012 Hans-Frieder Vogt
2012-03-15 14:35 ` poma
2012-03-15 15:03 ` Gianluca Gennari
2012-03-15 18:47 ` poma
2012-03-20 0:26 ` Mauro Carvalho Chehab
2012-03-20 22:14 ` [PATCH] v0.3 " Hans-Frieder Vogt
2012-03-20 22:33 ` Michael Büsch [this message]
2012-03-31 22:26 ` [PATCH] Support for tuner FC0012, revised version 0.4 Hans-Frieder Vogt
2012-05-13 17:21 ` 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=20120320233312.2a204746@milhouse \
--to=m@bues.ch \
--cc=hfvogt@gmx.net \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).