Received: by 2002:a9a:4c47:0:b029:116:c383:538 with SMTP id u7csp854988lko; Tue, 13 Jul 2021 11:32:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwS5U2IVvCgSeOduM8Ob7Q3BO/JafQ/lV5YQZFCU1pnFErkZrxMODOYWJUeJ0RUfy2kP9vV X-Received: by 2002:a92:6605:: with SMTP id a5mr4094500ilc.15.1626201156714; Tue, 13 Jul 2021 11:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626201156; cv=none; d=google.com; s=arc-20160816; b=X5EFqysUtyA4oNDnxlmxzvbW9aP/NzJbMZd/Ry1VDuSgRjpbSdYRUVT1PWbOP1nPVL Am72EEHVZUvlAydcRWrmrTsb/0dhJdtH4nsn4HNTgX4h2naF7J5CckP7CqO5uG4GKI63 mk/+FCGrrkyunWxDGHnRgVklvR/BoGvyQyfX+BD0ACnkELupnFuel4vT+HYfV7vvEYNM jwJIFS4xx84yYxnztBgfoSTo4SAuwW+cEa5JRQFGRWVpIRCJ1/BIRidrxGb1B1HAMlBv eZUpMk+o2EmekOjfyGxm8t91szA6hvKcXkHYqconMRJpM64xhJXA+dnfVxKkyzUMJ2j7 huxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9YX3KaYPNTTmjOqBKaIiOKVXMBstGoy/1b6T+CZC0ck=; b=yFmcKQVPkWqROITNgtu1WUGiCSxjryRuYnRHdIWrLl75VASvp+XHyxtbxJ0QC5Pl7x IYPotqoKislQblFr/ZuzGDno6qY2MyAVDhH0tGRckdNueHw/Vc+tkUg7yZD/gQ89Fl3C hm3NCxKO4BY/u8l0BhfYTEsA7TCcOqU00vGSB6EmDFDkrJ02NpfI088urlF1Gt1DZHhk 3FlhuefJDhpacC4PLLFXyB5ni2sQvW3oTVVHGkKcSbFNRHYFdBbn3BBN7XF3fkVShD1l 2Y12qI03TL+vV6A3eEAXMyN1sXr7RjfieERMdO8bJrwFqMfd7UWWgYgY9LoBULajjufR hsWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=H6tJizJF; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i9si22341971ioq.17.2021.07.13.11.32.11; Tue, 13 Jul 2021 11:32:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=H6tJizJF; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230376AbhGMSex (ORCPT + 99 others); Tue, 13 Jul 2021 14:34:53 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:53088 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbhGMSew (ORCPT ); Tue, 13 Jul 2021 14:34:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=9YX3KaYPNTTmjOqBKaIiOKVXMBstGoy/1b6T+CZC0ck=; b=H6tJizJFpKicvb4o0o7PicCO8U NJHCGYB5r0WQBKZm2BePBdcb2fBVVqI/kojVDQljkJZUHVKxtWBNGpIqbDqS3E6eb8BuLQVWD80aR iF0Oa0LyJzjlAM+b4QzwbgKhjPt8dI5x67rYCnaMS3ZtYvAHWxTRiTtMw4uRnRrqHofk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1m3NCI-00DFC4-So; Tue, 13 Jul 2021 20:31:58 +0200 Date: Tue, 13 Jul 2021 20:31:58 +0200 From: Andrew Lunn To: Felix Fietkau Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, pablo@netfilter.org, ryder.lee@mediatek.com Subject: Re: [RFC 2/7] net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED) Message-ID: References: <20210713160745.59707-1-nbd@nbd.name> <20210713160745.59707-3-nbd@nbd.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210713160745.59707-3-nbd@nbd.name> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org > diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c > + > +static inline void > +wed_m32(struct mtk_wed_device *dev, u32 reg, u32 mask, u32 val) > +{ > + regmap_update_bits(dev->hw->regs, reg, mask | val, val); > +} Please don't use inline functions in .c files. Let the compiler decide. > +static void > +mtk_wed_reset(struct mtk_wed_device *dev, u32 mask) > +{ > + int i; > + > + wed_w32(dev, MTK_WED_RESET, mask); > + for (i = 0; i < 100; i++) { > + if (wed_r32(dev, MTK_WED_RESET) & mask) > + continue; > + > + return; > + } It may be better to use something from iopoll.h > +static inline int > +mtk_wed_device_attach(struct mtk_wed_device *dev) > +{ > + int ret = -ENODEV; > + > +#ifdef CONFIG_NET_MEDIATEK_SOC_WED if (IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED) is better, since it compiles the code, and then the optimizer throws away. > + rcu_read_lock(); > + dev->ops = rcu_dereference(mtk_soc_wed_ops); > + if (dev->ops) > + ret = dev->ops->attach(dev); > + rcu_read_unlock(); > + > + if (ret) > + dev->ops = NULL; > +#endif > + > + return ret; > +} Andrew