Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp223540pxx; Wed, 28 Oct 2020 03:18:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfa7zqBgT9MB/Qn7APGB6xlUo9BFPFGJHAzZJxAy+G6huPqUaqiQiIXvA8OObjtnLdE9WT X-Received: by 2002:a05:6402:135a:: with SMTP id y26mr6884351edw.114.1603880325549; Wed, 28 Oct 2020 03:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603880325; cv=none; d=google.com; s=arc-20160816; b=u1rPqi58okWRyGWBksolN6JiWsaHXBPt0Xlnn+ynWdUidAwcfi0qIipvXx0nsFVM0J QOEGHV4+0gIS25Cdy3L62vXbJephlJjJXJXvxOftutz+wEkdgiZjf/EY+32UFQ4QRzRG 6XWxG6j+BGZvM4o/DbJsCIPfQi27elowyyIsMkdWdvvdpatvGf4IDhHpFqgrF4b181V/ PiIcy2Q7Z+NanBf3hC/pSTdc+Nuz9V1lkkFwHJNHiYkoHTSpE7TtuQZAPV3e4LySmnrX f5pux7jLykOtv0E1kozhILIY+0m1U3RjcIMkxsaYWRTSiUjzKKxiVNOqj9x9jYJBRXnJ unQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ppIb33g+u8KheeEQ2a2fFy0ZNYPJiCoashJj9+BNQrM=; b=TGY1U6NYDpThJ3pR51kepOJWcOXO0OJV0Bo6sp6WYy0cMKw0dklUZeUZrjDMFBsAAW O8s1woEX0Ae9shBUwdFmL8Joq7plmhdzhLGSdrUnZ+8TBaT7IqKVCxjz9cviZ5DgvV+q Zu2+OErfviePqLL2tD0G6Nbt9N8bos7Od5YI2O5G/hDwE+4K9PsFs24+pufuQbRlm9sl JclzTxs9qK7ihFevL42VzMghLMgZobnYpCqdMIsNWCutLaLtO0CkzAT8zE9tAPuLkWcB QNv41YSdXNo4P/sVAJ2HvgvXyzazfHx7cEr99G9mBdiizBMfiF4fZs0THI0xvd+P1F60 e3og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S0DIF67h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr1si3058858ejb.164.2020.10.28.03.18.23; Wed, 28 Oct 2020 03:18:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S0DIF67h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760978AbgJ0OhU (ORCPT + 99 others); Tue, 27 Oct 2020 10:37:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:36260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760974AbgJ0OhR (ORCPT ); Tue, 27 Oct 2020 10:37:17 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 7703122264; Tue, 27 Oct 2020 14:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809437; bh=Mo/1xVa9xkqYaUt5Pu3zhl2zMiGY1Tzf4thors6+zaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S0DIF67htH2T1gdi8+E657zgRAZEY+AHQjkphj/s26f1AgCGuvF/N29kO1PZHwhhW tNxzie3LYdNLLDI1fEFcH4TAJfZ314U1FWG/8v7TY1tzOqvlPYztkNLplnXKAJYly6 HJ4YwSjLdcV8PGDl34viMshb1satDyqWoM8VMu8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Parshuram Thombare , Boris Brezillon , Sasha Levin Subject: [PATCH 5.4 196/408] i3c: master add i3c_master_attach_boardinfo to preserve boardinfo Date: Tue, 27 Oct 2020 14:52:14 +0100 Message-Id: <20201027135504.186453071@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Parshuram Thombare [ Upstream commit 9da36a7ec42135428e1d41621e3703429bda3b2e ] Boardinfo was lost if I3C object for devices with boardinfo available are not created or not added to the I3C device list because of some failure e.g. SETDASA failed, retrieve info failed etc This patch adds i3c_master_attach_boardinfo which scan boardinfo list in the master object and 'attach' it to the I3C device object. Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure") Signed-off-by: Parshuram Thombare Signed-off-by: Boris Brezillon Link: https://lore.kernel.org/linux-i3c/1590053542-389-1-git-send-email-pthombar@cadence.com Signed-off-by: Sasha Levin --- drivers/i3c/master.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 5c051dba32a51..6cc71c90f85ea 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1760,6 +1760,21 @@ static void i3c_master_bus_cleanup(struct i3c_master_controller *master) i3c_master_detach_free_devs(master); } +static void i3c_master_attach_boardinfo(struct i3c_dev_desc *i3cdev) +{ + struct i3c_master_controller *master = i3cdev->common.master; + struct i3c_dev_boardinfo *i3cboardinfo; + + list_for_each_entry(i3cboardinfo, &master->boardinfo.i3c, node) { + if (i3cdev->info.pid != i3cboardinfo->pid) + continue; + + i3cdev->boardinfo = i3cboardinfo; + i3cdev->info.static_addr = i3cboardinfo->static_addr; + return; + } +} + static struct i3c_dev_desc * i3c_master_search_i3c_dev_duplicate(struct i3c_dev_desc *refdev) { @@ -1815,10 +1830,10 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, if (ret) goto err_detach_dev; + i3c_master_attach_boardinfo(newdev); + olddev = i3c_master_search_i3c_dev_duplicate(newdev); if (olddev) { - newdev->boardinfo = olddev->boardinfo; - newdev->info.static_addr = olddev->info.static_addr; newdev->dev = olddev->dev; if (newdev->dev) newdev->dev->desc = newdev; -- 2.25.1