All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] ARM: mach-shmobile: Mackerel VGA camera support
Date: Fri, 24 Dec 2010 04:03:09 +0000	[thread overview]
Message-ID: <20101224040309.GM28151@linux-sh.org> (raw)
In-Reply-To: <20101222144740.23663.49079.sendpatchset@t400s>

On Wed, Dec 22, 2010 at 11:47:40PM +0900, Magnus Damm wrote:
> +static struct soc_camera_link camera_link = {
> +	.bus_id		= 0,
> +	.add_device	= mackerel_camera_add,
> +	.del_device	= mackerel_camera_del,
> +	.module_name	= "soc_camera_platform",
> +	.priv		= &camera_info,
> +};
> +
> +static void dummy_release(struct device *dev)
> +{
> +}
> +
> +static struct platform_device camera_device = {
> +	.name		= "soc_camera_platform",
> +	.dev		= {
> +		.platform_data	= &camera_info,
> +		.release	= dummy_release,
> +	},
> +};
> +
> +static int mackerel_camera_add(struct soc_camera_link *icl,
> +			       struct device *dev)
> +{
> +	if (icl != &camera_link)
> +		return -ENODEV;
> +
> +	camera_info.dev = dev;
> +
> +	return platform_device_register(&camera_device);
> +}
> +
I guess we should probably have the resource request doing here and
tidied up after in the ->release()? The ordering here is pretty magical.

> +static void mackerel_camera_del(struct soc_camera_link *icl)
> +{
> +	if (icl != &camera_link)
> +		return;
> +
> +	platform_device_unregister(&camera_device);
> +	memset(&camera_device.dev.kobj, 0,
> +	       sizeof(camera_device.dev.kobj));
> +}
> +
Any time a board needs to touch a device's kobject resources there's
something horribly horribly wrong. If the kobject is left particually
constructed after unregistration and causing corruption when the camera
is re-attached, then this needs to be corrected in the driver model, not
here.

The camera_link checks also look pretty bogus. This will only be called
in to for non-i2c devices, which already establish the reference to
&camera_link in the platform device's private data.

  reply	other threads:[~2010-12-24  4:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-22 14:47 [PATCH] ARM: mach-shmobile: Mackerel VGA camera support Magnus Damm
2010-12-24  4:03 ` Paul Mundt [this message]
2010-12-24 22:52 ` Guennadi Liakhovetski

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=20101224040309.GM28151@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-sh@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.