Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp748078rwb; Mon, 26 Sep 2022 05:29:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YjnNrLlbXq8c6CIQjnT1OKjo4tTnyVmbPcL23jumiV9OogJAKIeN4KGxKq3zBlvR+X2Jt X-Received: by 2002:a17:902:c205:b0:178:5083:f656 with SMTP id 5-20020a170902c20500b001785083f656mr21782203pll.81.1664195395285; Mon, 26 Sep 2022 05:29:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664195395; cv=none; d=google.com; s=arc-20160816; b=ZJq2+KAWxWWDwCTKaeDwvLmLr5RXkJctquIIRmgE9w4TZBzMjvta1wv6ZvUf4BwW9A YXnLkvgFrn7vuSuVEXwrdKwgDflvY/AlJ/d3qqPO+RU1dmqkLOUPINCxYg1jBZDl6WA/ Trd09j0zXIyrKktITptxNh4yKbOlDHMpWHJ+TFpOvzZ16MY5D2p7AsGPmublmTzDxnS6 fweerc09h/tV//+Z4zR5/TdZ8mXdSCxp0jGlpW1KH19zI+YmEIkcPxDv5mZqFEwAG5si +spShoGy1VGLla8Vv4fUoI9PTJa7V1ufNaRHDAN+ut7E6p73hnRUy5kYWf6XbV5I9Ao1 V0CA== 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 :message-id:date:subject:to:from; bh=RKs82nr+xrCLNRXKZ1UUBQWZnJaau+AUILnaZkgRGVc=; b=t0BabXFOEJ081JM2JHa0jjD/ZEpD15xMxWlm6prlTIZyYXZyS3cLObqRSRiH6CuBaL a/6rXeEfzaiDiCKlwAvfzTpYD/F/BjfwRD+uTWlateW79Bf5REMJj+udBSGyoEeDc/Ma /cL4x3gJXWJWdDgD7Uy6q5hqNpZlxndeUzekl/vQLSWrgkcXo/TxetWLJWg9UO5giW6j T1yD4Tzjo3AWREQTe58lElqWoJdQb7q1dUQ3vM/PCrBjL5VxKKYTGamsO6erK392XlqF w4ZgKJhC16LADLc2MTagRuaKwvwV+QN4zj+f/WHAMyjRUKJ0BsdZe/lzrV1Jvl2EtIhJ JQ9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u16-20020a170902e5d000b00176c0e055d8si11777880plf.102.2022.09.26.05.29.44; Mon, 26 Sep 2022 05:29:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239238AbiIZMC1 (ORCPT + 99 others); Mon, 26 Sep 2022 08:02:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239422AbiIZL6x (ORCPT ); Mon, 26 Sep 2022 07:58:53 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A275D79ED6 for ; Mon, 26 Sep 2022 03:52:44 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 28QATohO057043; Mon, 26 Sep 2022 18:29:50 +0800 (GMT-8) (envelope-from billy_tsai@aspeedtech.com) Received: from BillyTsai-pc.aspeed.com (192.168.2.149) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 26 Sep 2022 18:50:57 +0800 From: Billy Tsai To: , , , Subject: [PATCH 1/2] i3c: master: Free the old_dyn_addr when reattach. Date: Mon, 26 Sep 2022 18:51:44 +0800 Message-ID: <20220926105145.8145-1-billy_tsai@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.2.149] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 28QATohO057043 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch is used to free the old_dyn_addr when the caller want to reattach the device to the different dynamic address. If the old_dyn_addr is 0 the function will treat it as no old_dyn_addr is reserved on the bus. Without the patch, when the driver reattach the i3c device after setnewda the old_dyn_addr will be permanently occupied. Signed-off-by: Billy Tsai --- drivers/i3c/master.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 7850287dfe7a..6349ce0ce835 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1379,6 +1379,9 @@ static int i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev, i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, I3C_ADDR_SLOT_I3C_DEV); + if (old_dyn_addr) + i3c_bus_set_addr_slot_status(&master->bus, old_dyn_addr, + I3C_ADDR_SLOT_FREE); } if (master->ops->reattach_i3c_dev) { -- 2.25.1