All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, linux-input@vger.kernel.org,
	Jiri Kosina <jkosina@suse.cz>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [RFC PATCH 2/3] radio-keene: add a driver for the Keene FM Transmitter.
Date: Mon, 16 Jan 2012 13:44:37 +0100	[thread overview]
Message-ID: <201201161344.37499.oneukum@suse.de> (raw)
In-Reply-To: <955b875452cd4dca966f87d45a31a718637b03c0.1326716517.git.hans.verkuil@cisco.com>

Am Montag, 16. Januar 2012, 13:29:19 schrieb Hans Verkuil:
> From: Hans Verkuil <hans.verkuil@cisco.com>

> +MODULE_DEVICE_TABLE(usb, usb_keene_device_table);
> +
> +struct keene_device {
> +	struct usb_device *usbdev;
> +	struct usb_interface *intf;
> +	struct video_device vdev;
> +	struct v4l2_device v4l2_dev;
> +	struct v4l2_ctrl_handler hdl;
> +	struct mutex lock;
> +
> +	u8 buffer[BUFFER_LENGTH];

This is a violation of the DMA  API. You need to alocate the buffer with
a separate kmalloc.

> +	unsigned curfreq;
> +	u8 tx;
> +	u8 pa;
> +	bool stereo;
> +	bool muted;
> +	bool preemph_75_us;
> +};
> +
> +static inline struct keene_device *to_keene_dev(struct v4l2_device *v4l2_dev)
> +{
> +	return container_of(v4l2_dev, struct keene_device, v4l2_dev);
> +}
> +
> +/* Set frequency (if non-0), PA, mute and turn on/off the FM transmitter. */
> +static int keene_cmd_main(struct keene_device *radio, unsigned freq, bool play)
> +{
> +	unsigned short freq_send = freq ? (freq - 76 * 16000) / 800 : 0;
> +	int ret;
> +
> +	radio->buffer[0] = 0x00;
> +	radio->buffer[1] = 0x50;
> +	radio->buffer[2] = (freq_send >> 8) & 0xff;
> +	radio->buffer[3] = freq_send & 0xff;

Please use the endianness macro appropriate here

	Regards
		Oliver

  reply	other threads:[~2012-01-16 12:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16 12:29 [RFC PATCH 0/3] New driver for the Keene USB FM Transmitter Hans Verkuil
2012-01-16 12:29 ` [RFC PATCH 1/3] v4l2-ctrls: fix ugly control name Hans Verkuil
2012-01-16 12:29   ` [RFC PATCH 2/3] radio-keene: add a driver for the Keene FM Transmitter Hans Verkuil
2012-01-16 12:44     ` Oliver Neukum [this message]
2012-01-16 13:02       ` Hans Verkuil
2012-01-16 13:11         ` Oliver Neukum
2012-01-16 17:28           ` Alan Cox
2012-01-16 12:46     ` Oliver Neukum
2012-01-16 13:03       ` Hans Verkuil
2012-01-16 13:15         ` Oliver Neukum
2012-01-16 12:29   ` [RFC PATCH 3/3] hid-core: ignore the Keene FM transmitter Hans Verkuil
2012-01-16 13:00   ` [RFC PATCH 1/3] v4l2-ctrls: fix ugly control name Oliver Neukum
2012-01-16 13:04     ` Hans Verkuil

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=201201161344.37499.oneukum@suse.de \
    --to=oneukum@suse.de \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.