Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4814460yba; Tue, 30 Apr 2019 04:58:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8icbIeKp+DkXSXQqTuwkMc2WFDF22iLgaLCWrWkYO6ACWhAN4cBZIHJZOmOasaEL2XZu1 X-Received: by 2002:aa7:820c:: with SMTP id k12mr70112332pfi.177.1556625514553; Tue, 30 Apr 2019 04:58:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556625514; cv=none; d=google.com; s=arc-20160816; b=B3dXN4fI0oCL72DhYgmKnUjD5xOfegJnTGi2mDsgIIaeOCP5wh8WsFTDjoOLad87kn lIC4GxGvYKrX7f4er+9zv2h4BVugImo7CUmO/8O+jCEcEM/ceuHY8i95sgA5wfbcdYDR skDDq5oxQCp9WCvT7mTbCrpc5tixyhEl1JdzlT1worQMb4AMWl6gocXcN5hXINLFaifF goZzk7OGN7qvhwBDyqdbutm5qXZAYOTVTYw27+XtrpnilAT8N1jbw++vCVIYFh2D9l/K 3vh/878vwatI+Fr+LixZpRfK36FLyQtXj/KEVP+0Lo2w2s8jXtG//um/YiiT6IpHgh2E INqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dmarc-filter :dkim-signature:dkim-signature; bh=9r7OxE2riUdDpq5vdUb0JcPpKocTrvDTrAOpnmVE6aU=; b=d/MnWD6DxxFPXqBkK3h3cF1/pwzz0SwMguStqU6EM5Pp442T16Cc6JcRAoUh4o9xrY CSUUPiwXX9zbNKfk01PvsoKeNQbSRTf7nkoM05weh4aP8IDkgQs0ddCRw3B1Nf5+gJzx rn4F43khDZc4gC+hffSyf6oo2ZKUEC7P1JRNMOCjNer01LUAmLiYW2hzZVZJYIuCLCks Xys988C+KfCGPNf0WHbVn7mMEnDEUxFo2YzxjqcfISauowkgDFqrBh4R2MLVt2jJ4hpr pmSZeR9zWzIIU/wDKYLZSDWK/b/tWyoYA7xeEWEOXaS32gOM9tMdFDQY94axyw8IW7c6 vCTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hMGueTkb; dkim=pass header.i=@codeaurora.org header.s=default header.b=RAB9lOhM; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f64si38139122pfc.168.2019.04.30.04.58.19; Tue, 30 Apr 2019 04:58:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hMGueTkb; dkim=pass header.i=@codeaurora.org header.s=default header.b=RAB9lOhM; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730231AbfD3Lsv (ORCPT + 99 others); Tue, 30 Apr 2019 07:48:51 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:53592 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729800AbfD3Lsu (ORCPT ); Tue, 30 Apr 2019 07:48:50 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CC9B46044E; Tue, 30 Apr 2019 11:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1556624930; bh=YMdQrgOWXRWj+xQxFauMEUP9g2WmtgYi2qRDnZAjh58=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=hMGueTkbKOglv+98TdsO/2XOj41eXezmO+qj4+rcWruUg0WB5w6JW3ezemktSOSR9 5Li9K6mt308PN5w4VO+mP3shEi04AbUZUS39bD7PxZzd2uJMd0S96tE2CYlAuKb+Gy TxA7gnOCG5/f3M2q2MNd5ALNWMkXzayyw62MilE4= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 708F36044E; Tue, 30 Apr 2019 11:48:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1556624927; bh=YMdQrgOWXRWj+xQxFauMEUP9g2WmtgYi2qRDnZAjh58=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=RAB9lOhMlafSGKHGzDaS9bim5lV7V7ZlRUjIBfkVe/P1j0yJK6pOUVNl1kyYoAaCs G1kTrc7f8df5RU1Uix92+Nx+JzNSzjwwkWgPQbGp39clktmMxJtXQw2gC24Q/6K7QF IfpMlS6cEfVcssNeq3yESghK/zUIft5Wh6sr31/A= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 708F36044E Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: Cc: , , , , , , , Subject: Re: [PATCH v9 05/14] rtw88: mac files References: <1555653004-1795-1-git-send-email-yhchuang@realtek.com> <1555653004-1795-6-git-send-email-yhchuang@realtek.com> Date: Tue, 30 Apr 2019 14:48:43 +0300 In-Reply-To: <1555653004-1795-6-git-send-email-yhchuang@realtek.com> (yhchuang@realtek.com's message of "Fri, 19 Apr 2019 13:49:55 +0800") Message-ID: <87v9yvpvc4.fsf@kamboji.qca.qualcomm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org writes: > From: Yan-Hsuan Chuang > > mac files for Realtek 802.11ac wireless network chips > > Reviewed-by: Stanislaw Gruszka > Signed-off-by: Yan-Hsuan Chuang [...] > +static int rtw_pwr_cmd_polling(struct rtw_dev *rtwdev, > + struct rtw_pwr_seq_cmd *cmd) > +{ > + u8 value; > + u8 flag = 0; > + u32 offset; > + u32 cnt = RTW_PWR_POLLING_CNT; > + > + if (cmd->base == RTW_PWR_ADDR_SDIO) > + offset = cmd->offset | SDIO_LOCAL_OFFSET; > + else > + offset = cmd->offset; > + > + do { > + cnt--; > + value = rtw_read8(rtwdev, offset); > + value &= cmd->mask; > + if (value == (cmd->value & cmd->mask)) > + return 0; > + if (cnt == 0) { > + if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE && > + flag == 0) { > + value = rtw_read8(rtwdev, REG_SYS_PW_CTRL); > + value |= BIT(3); > + rtw_write8(rtwdev, REG_SYS_PW_CTRL, value); > + value &= ~BIT(3); > + rtw_write8(rtwdev, REG_SYS_PW_CTRL, value); > + cnt = RTW_PWR_POLLING_CNT; > + flag = 1; > + } else { > + return -EBUSY; > + } > + } else { > + udelay(50); > + } > + } while (1); Never ending loops in kernel are dangerous. I would add some kind of fail safe to "while (1)", for example max number of loops or some time based limit. -- Kalle Valo