From patchwork Tue Feb 22 09:57:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 579961 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1M9vqqb029184 for ; Tue, 22 Feb 2011 09:57:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752314Ab1BVJ5v (ORCPT ); Tue, 22 Feb 2011 04:57:51 -0500 Received: from moutng.kundenserver.de ([212.227.126.171]:53604 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750930Ab1BVJ5u (ORCPT ); Tue, 22 Feb 2011 04:57:50 -0500 Received: from axis700.grange (pD9EB8B24.dip0.t-ipconnect.de [217.235.139.36]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0LfYt7-1QORzk1HAH-00ok28; Tue, 22 Feb 2011 10:57:46 +0100 Received: by axis700.grange (Postfix, from userid 1000) id F1E92189B80; Tue, 22 Feb 2011 10:57:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id EF764189B7F; Tue, 22 Feb 2011 10:57:44 +0100 (CET) Date: Tue, 22 Feb 2011 10:57:44 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Linux Media Mailing List cc: linux-sh@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 2/3] sh: switch ap325rxa to dynamically manage the platform camera In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Provags-ID: V02:K0:YhC3knoWGjxD2bTpCvVXDKr0kuV4cWOOLxB2UIFBcN2 fizqtJ3WCERFQyDF8Y04BJ546k/D75xszBP5TwGS1eDJCrXoPf iSTmxCiFkWgaiaicFR0k4weiCXzPP7xv4j/R//v8GLWCbq6rJg 7nQXritTuF/TkIIeGjN+6S2HXdD+SZ1Ar28vmQ+YyUcenYjzP3 HEFmbQEfUmAQrwomZIWhNYOmIlWmcLFP+JJp3hJOwQ= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 22 Feb 2011 09:57:53 +0000 (UTC) diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c index 3e5fc3b..33bfebc 100644 --- a/arch/sh/boards/mach-ap325rxa/setup.c +++ b/arch/sh/boards/mach-ap325rxa/setup.c @@ -343,37 +343,31 @@ static struct soc_camera_link camera_link = { .priv = &camera_info, }; -static void dummy_release(struct device *dev) +static struct platform_device *camera_device; + +static void ap325rxa_camera_release(struct device *dev) { + soc_camera_platform_release(&camera_device); } -static struct platform_device camera_device = { - .name = "soc_camera_platform", - .dev = { - .platform_data = &camera_info, - .release = dummy_release, - }, -}; - static int ap325rxa_camera_add(struct soc_camera_link *icl, struct device *dev) { - if (icl != &camera_link || camera_probe() <= 0) - return -ENODEV; + int ret = soc_camera_platform_add(icl, dev, &camera_device, &camera_link, + ap325rxa_camera_release, 0); + if (ret < 0) + return ret; - camera_info.dev = dev; + ret = camera_probe(); + if (ret < 0) + soc_camera_platform_del(icl, camera_device, &camera_link); - return platform_device_register(&camera_device); + return ret; } static void ap325rxa_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)); + soc_camera_platform_del(icl, camera_device, &camera_link); } #endif /* CONFIG_I2C */