Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3996204rwe; Tue, 30 Aug 2022 02:43:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5opYo6dXTY2Af4Jd5oQbUPxSFxkPmwXfyYAu/2414E9DcOLiTECiUp7icwIJrjgWGkUgbP X-Received: by 2002:a17:907:7f0b:b0:731:b81a:1912 with SMTP id qf11-20020a1709077f0b00b00731b81a1912mr16467415ejc.8.1661852624769; Tue, 30 Aug 2022 02:43:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661852624; cv=none; d=google.com; s=arc-20160816; b=JCqw1LwfHqZz9C6Y+dKoCbM5wsrq/w/eP1/5D3YtZ0B72PuB13NCcYSYF5VDj/b7BC q1qFMQpaLrI2xq+O1C/cKwum/IegPARC5uzp0oP3jfxg8AOndWmh40F9Vv97Q+kedQv8 yavOZr9smGSadnuaqRHeUeUhrjUi/kDNq2Kdl+ypOB0kzipoQNgU5RaDQWhUOgx0jj0Q GJBn72+dZgZJ0vl+EL65jMiTLJzjPbDK9Wb/wV/sc5s+VJwIfZBMzHSM+E8kAmHG2s2j Q1hZYJH8nSq9Ww5Zx8cJz9Nj061eqbKfwgRj6bovH0eHQqelaDkZvIelyp6oUutARpuJ nkzQ== 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:cc:to:from:dkim-signature; bh=dwsmMY4eQmBLbC8SZmYaa+/vzToYlmFgg45ktryj85M=; b=f/yMGjO8dIM+7Lbl8oIo+BmCrlaJVprqZAbNG+cfDkInBDVWpd+DS/FHz12Ro8A/co FVyeVFYzou87VzC2fNtDFiarXSYCumy6sCMwTs6uWs3bFZB82KOfRKJB/xoQPT71EIle wbZnylekcxeEQQQY23PIDtB5/vrf2XHPLwRBuYuPJMcnb8QH8JV1S7bK5NkiDNp4askV VG9n2WrTV/TXr//d+8WwqxhpiOdQXe+OEPmZUikw8XYNVCQ4ic+dbpBg0fIuR2ZPN6AO dXf9bZX6pIziJ7VvOa5N0U93W9u9n/RYB4t+DGfBDqm76hKZXmKE8CEEB5C4ThWNkpc0 yEFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=EESiaD3L; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s19-20020a1709060c1300b0073db945fcc0si2713700ejf.214.2022.08.30.02.43.16; Tue, 30 Aug 2022 02:43:44 -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; dkim=pass header.i=@collabora.com header.s=mail header.b=EESiaD3L; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbiH3Jjb (ORCPT + 99 others); Tue, 30 Aug 2022 05:39:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbiH3JjN (ORCPT ); Tue, 30 Aug 2022 05:39:13 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 545FFF32F7; Tue, 30 Aug 2022 02:37:15 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:10:389d:42df:ae4c:c047:294c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id 6B4B76601BF7; Tue, 30 Aug 2022 10:37:11 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1661852233; bh=b5EMCAqklGR1n0mJHp5xybG1xU4cd1JVpNMDf92YVuw=; h=From:To:Cc:Subject:Date:From; b=EESiaD3LrZwZ9y2nz6qqZgxhvdx9xDoCCINMgc+1v7rnk/1HZ0zO3eUYeyCHBn+qm deJpl3nOBWIsbDMIWl5ZCh1oUprkqb6Cjw3XkEYxFrCiy97EkBrWl7W/LWdbezQRkG unqgNDO3H/lR2n/inW5PeitcMCcjYkBaX9+gEDuUAJpFRkLgu7zpcHZ9Z02ynRwlyN 1+LqpCKAiA+Q08E9ubHbt79+rFBMKCwsAhFLkqXPIx3qNGCD+r3A+mebq4IaR41JuI +iIrDURS24PeOcDHp/5aZ4aCVxntZ2T1iBLK1b+LYkAjPBVg+qgVWUWlQBTwWo67uJ FFSugDG1v1VwA== From: Shreeya Patel To: broonie@kernel.org, sanju.mehta@amd.com Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, krisman@collabora.com, alvaro.soliverez@collabora.com, Shreeya Patel Subject: [PATCH] spi: amd: Fix speed selection Date: Tue, 30 Aug 2022 15:06:07 +0530 Message-Id: <20220830093607.45484-1-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 If the current speed is equal to the requested speed by the device then return success. This patch fixes a bug introduced by the commit 3fe26121dc3a ("spi: amd: Configure device speed") which checks speed_hz instead of amd_spi->speed_hz. Fixes: 3fe26121dc3a ("spi: amd: Configure device speed") Signed-off-by: Shreeya Patel --- drivers/spi/spi-amd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index 264633c5ce0b..e23121456c70 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -240,9 +240,6 @@ static int amd_set_spi_freq(struct amd_spi *amd_spi, u32 speed_hz) { unsigned int i, spd7_val, alt_spd; - if (speed_hz == amd_spi->speed_hz) - return 0; - if (speed_hz < AMD_SPI_MIN_HZ) return -EINVAL; @@ -250,7 +247,7 @@ static int amd_set_spi_freq(struct amd_spi *amd_spi, u32 speed_hz) if (speed_hz >= amd_spi_freq[i].speed_hz) break; - if (speed_hz == amd_spi_freq[i].speed_hz) + if (amd_spi->speed_hz == amd_spi_freq[i].speed_hz) return 0; amd_spi->speed_hz = amd_spi_freq[i].speed_hz; -- 2.30.2