Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp789108pxb; Tue, 5 Apr 2022 23:23:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFPWyyg5CCNM36/1uY5/ZUprcxdOIa/5feUd/eBsyd0bgGL+tw2X8KmV8uEaWnMZJQ3tJV X-Received: by 2002:a17:90b:4a4b:b0:1c6:4398:523c with SMTP id lb11-20020a17090b4a4b00b001c64398523cmr8108879pjb.50.1649226226822; Tue, 05 Apr 2022 23:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649226226; cv=none; d=google.com; s=arc-20160816; b=MvRJ5W6xfAIpRupEkwhAFlSqqdoQoJWI/xoNoS7KmKA1DQJHlLjECqEYQhNi3E8AFc NshD3GYkdRUP3/r9kAP1LwA63H43svU7nWWhYrJYDXDsjDklJOh2dz3jzb0ommit7F+q U7b4tx68JdAg7eonLtaRwTWMa2zcuD0ay7fs1lSpNvrVUUCYCrGDuYhbNMEz1b49WC3x d6gee1UKSiSdM1THSHlQXoAYyRt1xqVaD8ASQz/WyHoiw1JFLgR9D24XXqxjoyAozmYB qt6xx2TNPeqM22IMQY/p3H6qPJJZ+EdyMcD1LctuMA5ljpJw/FDqzX6rqzfgQV939yVp 1Wuw== 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=hfmh1ZuZMNnpijR+Uas/PMC5uYjKOQwUNHakS03jgQY=; b=w/UcYIOg+WIKS5mC5J4Sit5Q5lhx40lkPLH3+scWuCjTwGoARIn7/lKyo8P5TaJfH2 UwPphkZlToRVIpreyBtQi3L4ZRDhpAzZylkY35vVwWcmDOflT+Rj6ca7jM457QVyYPgw qXgR9LWg4I88YHtQtjln7zE5Vy+akzvuzPpK9C2mZIh0+uPYrzcfx4D745k3dtT5G2Gl 9SoiKKpqpqxmUD/KJyQcUxmoKtr2WMB22zdR3VveZ0gmk7E2g8h+34iJqNAfINiQcWvH aXGQyAuCm4LR7O4wF/a4b9Y5QLFQvQ3MDwMgMqUgFoJgGqV1elBFw2CEENqgH5u2G/f7 e59g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sGjQzniL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n1-20020a170902d2c100b00153b2d16531si3254665plc.313.2022.04.05.23.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 23:23:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sGjQzniL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F26992FC307; Tue, 5 Apr 2022 23:22:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583493AbiDEXw5 (ORCPT + 99 others); Tue, 5 Apr 2022 19:52:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349331AbiDEJtj (ORCPT ); Tue, 5 Apr 2022 05:49:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 331A92DF9; Tue, 5 Apr 2022 02:44:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8B5306164D; Tue, 5 Apr 2022 09:44:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93C98C385A3; Tue, 5 Apr 2022 09:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151843; bh=33NZsSJJ8AnEe2K5FZo3oYEbB5J35KI4bIowTRDBqLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sGjQzniLqP9Or4abam0luxA7w258e9SkOVlk7bIoN1oUj3HV/CmhGHqin/E60sW/A aH5xG9ekt5fixB4N0tlXiuH9yMovDAfkX75DjjnbS7ndaun9de70Q56JAKEm9xUbBP x9+PfRSM+Ml9FXSmGjhC3KGR9uJ4lwZI8xJRKmMU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Tanure , Neil Armstrong , Wolfram Sang , Sasha Levin Subject: [PATCH 5.15 561/913] i2c: meson: Fix wrong speed use from probe Date: Tue, 5 Apr 2022 09:27:03 +0200 Message-Id: <20220405070356.660956175@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Lucas Tanure [ Upstream commit cb13aa16f34f794a9cee2626862af8a95f0f0ee9 ] Having meson_i2c_set_clk_div after i2c_add_adapter causes issues for client drivers that try to use the bus before the requested speed is applied. The bus can be used just after i2c_add_adapter, so move i2c_add_adapter to the final step as meson_i2c_set_clk_div needs to be called before the bus is used. Fixes: 09af1c2fa490 ("i2c: meson: set clock divider in probe instead of setting it for each transfer") Signed-off-by: Lucas Tanure Reviewed-by: Neil Armstrong Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-meson.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c index ef73a42577cc..07eb819072c4 100644 --- a/drivers/i2c/busses/i2c-meson.c +++ b/drivers/i2c/busses/i2c-meson.c @@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev) */ meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, 0); - ret = i2c_add_adapter(&i2c->adap); - if (ret < 0) { - clk_disable_unprepare(i2c->clk); - return ret; - } - /* Disable filtering */ meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0); meson_i2c_set_clk_div(i2c, timings.bus_freq_hz); + ret = i2c_add_adapter(&i2c->adap); + if (ret < 0) { + clk_disable_unprepare(i2c->clk); + return ret; + } + return 0; } -- 2.34.1