mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Michael Krufky <mkrufky@m1k.net>
Cc: linux-kernel@vger.kernel.org, linux-dvb-maintainer@linuxtv.org,
	Kirk Lapray <kirk.lapray@gmail.com>
Subject: Re: [PATCH 30/37] dvb: add nxt200x frontend module
Date: Thu, 3 Nov 2005 14:11:25 +1100	[thread overview]
Message-ID: <20051103141125.1463c1bd.akpm@osdl.org> (raw)
In-Reply-To: <43672436.6000006@m1k.net>

Michael Krufky <mkrufky@m1k.net> wrote:
>
> 
> From: Kirk Lapray <kirk.lapray@gmail.com>
> 
> * nxt200x.c, nxt200x.h
> - New frontend module that supports both NXT2002 and NXT2004.
>   So far, only tested on NXT2004.  After testing on NXT2002, we should
>   deprecate the nxt2002 module, and implement this one instead on the
>   applicable cards.
> 
> * get_dvb_firmware:
> - Added support for the NXT2004 firmware. This firmware works with both
>   the ATI HDTV Wonder and the AVerTVHD MCE a180.
>   This was originally written by Jean-Francois Thibert
> 
> * dvb-pll.c
> - Fixed minimum frequency for tuv1236d. It seems that the data sheets
>   are wrong.
> 
> ...
> +static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, u8 *buf, u8 len)
> +{
> +	u8 buf2 [len+1];

hm, a variable-sized array, with the size defined by the caller.   I guess as the size is
in a u8 it's unlikely to cause too much trouble.

(Wonders what the compiler will do if len==255.  256, I think.)

> +static int nxt200x_readreg_multibyte (struct nxt200x_state* state, u8 reg, u8* data, u8 len)
> +{
> +	int i;
> +	u8 buf, len2, attr;
> +	dprintk("%s\n", __FUNCTION__);
> +
> +	/* set mutli register register */
> +	nxt200x_writebytes(state, 0x35, &reg, 1);
> +
> +	switch (state->demod_chip) {
> +		case NXT2002:
> +			/* set multi register length */
> +			len2 = len & 0x80;
> +			nxt200x_writebytes(state, 0x34, &len2, 1);
> +
> +			/* read the actual data */
> +			nxt200x_readbytes(state, reg, data, len);
> +			return 0;
> +			break;
> +		case NXT2004:
> +			/* probably not right, but gives correct values */
> +			attr = 0x02;
> +			if (reg & 0x80) {
> +				attr = attr << 1;
> +				if (reg & 0x04)
> +					attr = attr >> 1;
> +			}
> +
> +			/* set multi register length */
> +			len2 = (attr << 4) | len;
> +			nxt200x_writebytes(state, 0x34, &len2, 1);
> +
> +			/* toggle the multireg bit*/
> +			buf = 0x80;
> +			nxt200x_writebytes(state, 0x21, &buf, 1);
> +
> +			/* read status */
> +			nxt200x_readbytes(state, 0x21, &buf, 1);
> +
> +			if (buf == 0)
> +			{
> +				/* read the actual data */
> +				for(i = 0; i < len; i++) {
> +                    nxt200x_readbytes(state, 0x36 + i, &data[i], 1);
> +				}
> +				return 0;

whitespace broke.

> +			}
> +			break;
> +		default:
> +			return -EINVAL;
> +			break;
> +	}

We usually indent the body of a switch statement one tab further to the left.

> +
> +static int nxt200x_writetuner (struct nxt200x_state* state, u8* data)
> +{
> +	u8 buf, count = 0;
> +
> +	dprintk("%s\n", __FUNCTION__);
> +
> +	dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]);
> +
> +	/* if pll is a Philips TUV1236D then write directly to tuner */
> +	if (strcmp(state->config->pll_desc->name, "Philips TUV1236D") == 0) {

Does DVB have a better way of identifying a device type than strcmp?



  reply	other threads:[~2005-11-03  4:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-01  8:15 Michael Krufky
2005-11-03  3:11 ` Andrew Morton [this message]
2005-11-03 22:56   ` Mike Krufky
2005-11-04  5:12     ` Andrew Morton

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=20051103141125.1463c1bd.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=kirk.lapray@gmail.com \
    --cc=linux-dvb-maintainer@linuxtv.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@m1k.net \
    /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

all inboxes | Powered by JetHome®