Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9086027rwd; Wed, 21 Jun 2023 02:51:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45iThMWsV28AeMy5y+ZJcL7BLc7wRxfrxuc4ydOboGkhyJA2U97EH2hYC2PUs1HWF1u4dP X-Received: by 2002:a05:6358:cc1b:b0:130:f8d6:fa2a with SMTP id gx27-20020a056358cc1b00b00130f8d6fa2amr5285071rwb.13.1687341115027; Wed, 21 Jun 2023 02:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687341114; cv=none; d=google.com; s=arc-20160816; b=EGVGMH7X6YKFdygQBZm3b7vAt0K2PDmLJ7hInbAkpbqSROjtvQpfPM8WKtabXi80wa 78RNKou419PvB1VPfKvNJYKclxQuW+/ai/YPXCN8MEpwBE/ONUtNAnMkXIJLlQyMJjOA cyEl4bW854gloB3NwkMIcSX/scYqOWgltdg2cQF5aFtT0rP7DyUr0Nb68cy3dMxAhxHC 3hw6OTmdGarNC7KrsoMOKH5VD3zuZg/saS+0JtUO09cg9SKuzvUMKEv7YPNQjtFtXjbM MMfv42OWtJ1Ssr/4iyt78057KgwgpuVuU2Sj1WgkpGY+CroBGoVIrPWkUftY8gSVKXlW aSlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=mG1gpQG57YhK8ZWZbXT7n4VpxZ28fCfvetCErgFBycU=; b=DJKlFKCwu7+L48NFxQayhVu2mf10u0KokYnbTA4eVsBe2Zww6IG7lHePShVR0VKYQh ALugxilG2fgXXPkJDgh1kmbSRcxJST9pVAlQwS+8cYMg6l/B9fiFb8m7XwOwskL8xu4e iGwO7fyb8kSjS0hFvxJXaDtlTP0qeBgJbiULIY4od3gkJCINFBGHSTZxHq5mevOcHzMi G1UJj/si/i3iS9FudBOUqMfvZd65ccxw51rN4JYnGtM+wj0bwDCI0I5lRqw5XGpgWIJE EzQ7TMKRKpHmq/4kctEWMZVrEZGYFL76q+lRXLXUpa8F/bldArHSjDLd/3WTlZsdPyIj FdlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="M/WVnIJ8"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020aa78e48000000b006686d07f4b6si268234pfr.327.2023.06.21.02.51.47; Wed, 21 Jun 2023 02:51:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@kernel.org header.s=k20201202 header.b="M/WVnIJ8"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230050AbjFUJfV (ORCPT + 59 others); Wed, 21 Jun 2023 05:35:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231901AbjFUJec (ORCPT ); Wed, 21 Jun 2023 05:34:32 -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 0DBA11BC7 for ; Wed, 21 Jun 2023 02:32:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7DCC0614B6 for ; Wed, 21 Jun 2023 09:32:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 057D8C433C0; Wed, 21 Jun 2023 09:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687339959; bh=/iCNRmmomHR8mEwjqDMj0Boz/zJRnjQXqYJaolxNT3o=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=M/WVnIJ8EpmnX1lNlHoVYzZbqXpZ2ZFkvsQgeMb0TKcXJIgs1jeSVJ5XutaZ8SVY5 qwvxcIlamwsYhLDag+Hftl/M9KQNSXcEUPQxl4n1I7hSgbgxiSf2Mtx/CCYXiTlVfl WTeSsfKGi9SSg7fX68QFZe2moWsMT7jl/2ZOlhy6DSwAA26lX+9aeixAWRgEbRC5Y5 /+D2RoXEGOhyjQEtxgddpJhaEBjuKVQuFuvv4SFxkNPAGS7sUi/jRbCWRQHaHYkSDb TURbBZrJ6ntsc312KsWYcefCm1PyHla8Wf52PePlctyu+3zH2PSsQWgKwYApp0YKIl GqRG8cavnbaOQ== From: Kalle Valo To: Cc: , , Subject: Re: [PATCH v2] wifi: wilc1000: add SPI commands retry mechanism References: <20230614203215.9652-1-amisha.patel@microchip.com> Date: Wed, 21 Jun 2023 12:32:36 +0300 In-Reply-To: <20230614203215.9652-1-amisha.patel@microchip.com> (Amisha Patel's message of "Wed, 14 Jun 2023 20:32:46 +0000") Message-ID: <87zg4tdutn.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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-wireless@vger.kernel.org writes: > From: Amisha Patel > > In some situations like, chip wake-up with powersave enabled, SPI > commands are failing temporarily. Reissuing commands after reset helps > to overcome the failure. So, add the retry limit and reset command > sequence API for read/write SPI commands. > > Signed-off-by: Amisha Patel [...] > +retry: > result = wilc_spi_single_read(wilc, cmd, addr, data, clockless); > if (result) { > dev_err(&spi->dev, "Failed cmd, read reg (%08x)...\n", addr); > - return result; > + > + /* retry is not applicable for clockless registers */ > + if (clockless || !retry_limit) > + return result; > + > + wilc_spi_reset_cmd_sequence(wilc, retry_limit, addr); > + retry_limit--; > + goto retry; > } A for loop is recommended over a goto loop. Also in this case I find 'retry_limit == 0' more readable than '!retry_limit', it's a counter anyway. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches