Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2650493imj; Mon, 11 Feb 2019 06:28:48 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib8ds4ILL8Hbhlje7s82xTTkqJXUK05JCaT6wVfLJV2RUkWFrDT4NnrPEomMvW9sA7HTKs1 X-Received: by 2002:a17:902:7598:: with SMTP id j24mr37915662pll.7.1549895328621; Mon, 11 Feb 2019 06:28:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895328; cv=none; d=google.com; s=arc-20160816; b=f72tAaUrsjuNCeywg98I++gVObrrvvJcvWtSNQWRE7sEqKcyJPgGUyojv5ZZxdud3q zJgqwrLvnwH8bt5UTztzFkdgGl+1yKpUZIK98WeqvdxqzZxdTnTZ4gq5MYxfcKwvXaja xZ6UPXNyyN67nqDx0XuJXQL8viC388aWRtnlffyjm0+PvYzQdLQ3awNORWO2Ork+vggB TqvlBme6qjS6VVvbvrEkNa4N+GPgZZGJYB4Xpn0M7KRpdPOb3WK6Q/nUiB5LKWQMXrMo HafEp22v+SIxmiuqIiHuccmgAEImfrc0/NPShXmYHmvhSKmf/DTmwMtl41CbJXJT5Avd jdwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gzh3MJ3OpVtlGCHkB0PD3P8RvJ4jBaGcXthb68++Tqo=; b=MejZOT5WoTd0bY3ESkLEFwZBp3iN4Q5R6nn5UTyBE2CgXCPJw1QSanOPMqRCCFU+wV qWkcujgUlF+6mcxrddh2Nx7Dfd/gCncR7yERuv7eBaDNxDD0gQXgK69Fw/n7l04LkBCI TPxDJTieWryXecm11CDUqgJzIJPT0xl2vw9uBVYlM0xy/cMGh5DsZa9iJWPBjFEEEt/Y kM8Jldb/p5Jdi/WZfrDFwBCOeP9a97fcPiuQ6JgI5TRriOxOa92VfRAPAj6vNDiWzDlW jLFnZGDbJwGcj3tEVwY/QM8SWfny3GB9i43Y9xahokLGoquI94n88bIT+XP1MvkpGVlr s39g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0zIA8D2J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si9140385pgo.295.2019.02.11.06.28.32; Mon, 11 Feb 2019 06:28:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0zIA8D2J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729638AbfBKO04 (ORCPT + 99 others); Mon, 11 Feb 2019 09:26:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:60844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727247AbfBKO0z (ORCPT ); Mon, 11 Feb 2019 09:26:55 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ED49D20821; Mon, 11 Feb 2019 14:26:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895214; bh=Q12YCwGIfeS5gemNCB97bulDWB7sfDaZY0zamEHVeAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0zIA8D2JqVunKTyKoG8EcncPL11L3z0po9wRkceFYqXLun/ebgf0vOwHsm/B5TCdW 30dykSdOFUSp5Dx2hAR2rpRSZTXSOZHCzCe4Ohb/nCXELB+RJTePnWMnxOfEqIUSAq GPnZ3iVYu0yZ+5fnE3FYH6lGOcihCMtEgHcOQ7cY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomasz Figa , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.20 131/352] media: v4l2-device: Link subdevices to their parent devices if available Date: Mon, 11 Feb 2019 15:15:58 +0100 Message-Id: <20190211141854.809725511@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit ee494cf377e142f65f202fadf0d859f8e12119fb ] Currently v4l2_device_register_subdev_nodes() does not initialize the dev_parent field of the video_device structs it creates for subdevices being registered. This leads to __video_register_device() falling back to the parent device of associated v4l2_device struct, which often does not match the physical device the subdevice is registered for. Due to the problem above, the links between real devices and v4l-subdev nodes cannot be obtained from sysfs, which might be confusing for the userspace trying to identify the hardware. Fix this by initializing the dev_parent field of the video_device struct with the value of dev field of the v4l2_subdev struct. In case of subdevices without a parent struct device, the field will be NULL and the old behavior will be preserved by the semantics of __video_register_device(). Signed-off-by: Tomasz Figa Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/v4l2-core/v4l2-device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index df0ac38c4050..e0ddb9a52bd1 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -247,6 +247,7 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev) video_set_drvdata(vdev, sd); strscpy(vdev->name, sd->name, sizeof(vdev->name)); + vdev->dev_parent = sd->dev; vdev->v4l2_dev = v4l2_dev; vdev->fops = &v4l2_subdev_fops; vdev->release = v4l2_device_release_subdev_node; -- 2.19.1