From patchwork Mon Mar 30 08:48:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 15102 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2U8mOR8010692 for ; Mon, 30 Mar 2009 08:48:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754977AbZC3IsP (ORCPT ); Mon, 30 Mar 2009 04:48:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755186AbZC3IsO (ORCPT ); Mon, 30 Mar 2009 04:48:14 -0400 Received: from mail.gmx.net ([213.165.64.20]:41005 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754977AbZC3IsN (ORCPT ); Mon, 30 Mar 2009 04:48:13 -0400 Received: (qmail invoked by alias); 30 Mar 2009 08:48:05 -0000 Received: from p57BD1AB0.dip0.t-ipconnect.de (EHLO axis700.grange) [87.189.26.176] by mail.gmx.net (mp054) with SMTP; 30 Mar 2009 10:48:05 +0200 X-Authenticated: #20450766 X-Provags-ID: V01U2FsdGVkX197t+01qHd7hy4TeWqy7B6j251RNVjcP1paa7SIUO fPc3XgfIN9OvEl Received: from lyakh (helo=localhost) by axis700.grange with local-esmtp (Exim 4.63) (envelope-from ) id 1LoDAA-0001M6-Q1; Mon, 30 Mar 2009 10:48:10 +0200 Date: Mon, 30 Mar 2009 10:48:10 +0200 (CEST) From: Guennadi Liakhovetski To: Linux Media Mailing List cc: Kay Sievers Subject: [PATCH] soc-camera: fix breakage caused by 1fa5ae857bb14f6046205171d98506d8112dd74e Message-ID: MIME-Version: 1.0 X-Y-GMX-Trusted: 0 X-FuHaFi: -0.07000000000000001 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org soc-camera re-uses struct devices multiple times in calls to device_register(), therefore it has to reset the embedded struct kobject to avoid the "tried to init an initialized object" error, which then also erases its name. Now with the transition to kobject's name for device names, we have to re-initialise the name before each call to device_register(). Signed-off-by: Guennadi Liakhovetski --- Kay, is this an acceptable fix? Or should I rather replace memset(&icd->dev.kobj, 0, sizeof(icd->dev.kobj)); with just some variant of kobj->state_initialized = 0; ? drivers/media/video/soc_camera.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 6d8bfd4..0e890cc 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c @@ -764,7 +764,10 @@ static int soc_camera_s_register(struct file *file, void *fh, static int device_register_link(struct soc_camera_device *icd) { - int ret = device_register(&icd->dev); + int ret = dev_set_name(&icd->dev, "%u-%u", icd->iface, icd->devnum); + + if (!ret) + ret = device_register(&icd->dev); if (ret < 0) { /* Prevent calling device_unregister() */ @@ -1060,7 +1063,6 @@ int soc_camera_device_register(struct soc_camera_device *icd) icd->devnum = num; icd->dev.bus = &soc_camera_bus_type; - dev_set_name(&icd->dev, "%u-%u", icd->iface, icd->devnum); icd->dev.release = dummy_release; icd->use_count = 0;