Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3281077ybi; Mon, 17 Jun 2019 21:05:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6rzxC03TZBKHiubNzLDqfBBFts5hs3pYTCcPudPhyW86pxrfE2FwzoTCbUu4tDixOn6XH X-Received: by 2002:aa7:8a0c:: with SMTP id m12mr12648117pfa.2.1560830752081; Mon, 17 Jun 2019 21:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560830752; cv=none; d=google.com; s=arc-20160816; b=ZrSaCYFm2zhqYED4AvDSzKb1dcY8327BKp1zaq9tT9rZhrdOV0LFu0Yd40pz1B9z7K oNf2U/hW8z+WntPqCeqMCMtMuIChFTbXkxhGb/5zgizgsyyDmwAhFddFzrebIvLvKbOY /3+7WVdblQONgOnCkmCdEhS8fh8N4Vt86AV9QUpg5/puSxsDo2CPREGsLuM7mOlgsFO2 lNVoAeKGc/cs7wHDFqWaHxTbvmXuOOMqs+g4B+fIJd5gEuhaJdPSah+YfJWO5j6cxwrJ mou//lRoCsYaD5vgb4I4kHHmdKt8PuLpyJtHsNoKARuefLJyqR7yjT4fmOtzO0oVz8D3 eFfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=sJLmkVwnPans9/iuFpcwnbTM7EUsIIBXDTl8TGQaxjk=; b=02TO8N+kgGTUa7iGApP77zzsNzDe7fMcToruw6PXAUFqh9nqyrgcVmbM08VeN2hDln Bzo3i2TPdNzVYMsRfDrz3XEYNswOpeieTKhapd/6eN3vBiRQ2rMSF8c3filiwVR29kES MDjAJ8R/zy43HYi5qXDd09GCtljQpUeWi/6kwGd3fuy35Ndw80Oy1G5vF6FoZS2dnipX UnSF1sIDMgvtWArGt0WTi0Hy+UdfiNMo+2e45D3IUJ79HJsCKzRj0AfoKhP++3C36oGX ThJ7dehoQBJaAe8HuGdGcpA0dPeVce6sOd3T6D5hHwHa1xYE4wSPrE2KV3D5mmz48xrM 80Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=fNNVvfjL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 bc8si4577988plb.322.2019.06.17.21.05.36; Mon, 17 Jun 2019 21:05:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@sifive.com header.s=google header.b=fNNVvfjL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726359AbfFREEn (ORCPT + 99 others); Tue, 18 Jun 2019 00:04:43 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:46674 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725810AbfFREEl (ORCPT ); Tue, 18 Jun 2019 00:04:41 -0400 Received: by mail-lj1-f195.google.com with SMTP id v24so11527598ljg.13 for ; Mon, 17 Jun 2019 21:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sJLmkVwnPans9/iuFpcwnbTM7EUsIIBXDTl8TGQaxjk=; b=fNNVvfjLstujPCDm6U22v9kUb8V+ystPZzxjPsEpjTbMtRt6UZtFM3QfkWDyzAQMIW E6KfxvJkYCAiMigfxeNfkJbvlgJdvzEEfyDNXcSQ4hGpsd9Yv0PN3VCeG9Syybma3zAA YweVCf2jDX7KE7OToEgZ3Hm86et1Zzc1wT1rS2GKgDnXDs7wUV3rbSDjUKshW4DDBFiv WiW8rczljYaGap+qcx/bFr34QWpznmS62Lv9HHybuJDuuqKHqJD4Khp833m98/pUJhJR z/Wi3GOSjsiZFAWusKz/vCsNsKbGzD11ktzwf/VoHCT35CeFpX/vlTnPTD2hFmBTUNJt WypA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sJLmkVwnPans9/iuFpcwnbTM7EUsIIBXDTl8TGQaxjk=; b=THXa9XHX90eXbHc5xLoITEFHSPn6OQXKVtMULeJyZyO7dum48xk1rcbEqf/JDv/Xf1 eCtyBK37tyLlJweRFVm5+ganKUf6TDjb3DKG0NIBy1iKdTw7Zr/6t+N2fWccmknM3LA5 XfxR75AYxr4Op34N1H7jn1yWgN0z4Rm03cI3AJIA/DpJpdpfWzkGLgpbMNxk7hbhFsf+ MC0Gxp3Na/cO0yNqc375SV9EasNCfzW2bWyJWVBPmLLGhBeTzf/jWuAA/sELMEL8VHd4 XH46eteXy5RyiOKCFhNLCQ2+CqaQcV2d0RDmXz5tgf2FfdYzP8LNXWQs8jOjvxwlvPIa oAFA== X-Gm-Message-State: APjAAAUWoj7+XLU0gf8vW9lANCB3N1kYYTJC2le1l0vFXAMV7M77XP9N H0o8LNF4E8evYxbYd6+I5QK8w9J+7ekFArnDycG7Yw== X-Received: by 2002:a2e:b047:: with SMTP id d7mr13909677ljl.8.1560830679001; Mon, 17 Jun 2019 21:04:39 -0700 (PDT) MIME-Version: 1.0 References: <1560745167-9866-1-git-send-email-yash.shah@sifive.com> <1560745167-9866-3-git-send-email-yash.shah@sifive.com> <20190617155834.GK25211@lunn.ch> In-Reply-To: <20190617155834.GK25211@lunn.ch> From: Yash Shah Date: Tue, 18 Jun 2019 09:34:02 +0530 Message-ID: Subject: Re: [PATCH v2 2/2] macb: Add support for SiFive FU540-C000 To: Andrew Lunn Cc: David Miller , devicetree@vger.kernel.org, netdev , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Rob Herring , Mark Rutland , Nicolas Ferre , Palmer Dabbelt , Albert Ou , Paul Walmsley , =?UTF-8?Q?Petr_=C5=A0tetiar?= , Sachin Ghadi Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 17, 2019 at 9:28 PM Andrew Lunn wrote: > > On Mon, Jun 17, 2019 at 09:49:27AM +0530, Yash Shah wrote: ... > > static const struct macb_config at91sam9260_config = { > > .caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII, > > .clk_init = macb_clk_init, > > @@ -3992,6 +4112,9 @@ static int at91ether_init(struct platform_device *pdev) > > { .compatible = "cdns,emac", .data = &emac_config }, > > { .compatible = "cdns,zynqmp-gem", .data = &zynqmp_config}, > > { .compatible = "cdns,zynq-gem", .data = &zynq_config }, > > +#ifdef CONFIG_MACB_SIFIVE_FU540 > > + { .compatible = "sifive,fu540-macb", .data = &fu540_c000_config }, > > +#endif > > This #ifdef should not be needed. > > > { /* sentinel */ } > > }; > > MODULE_DEVICE_TABLE(of, macb_dt_ids); > > @@ -4199,6 +4322,9 @@ static int macb_probe(struct platform_device *pdev) > > > > err_disable_clocks: > > clk_disable_unprepare(tx_clk); > > +#ifdef CONFIG_MACB_SIFIVE_FU540 > > + clk_unregister(tx_clk); > > +#endif > > So long as tx_clk is NULL, you can call clk_unregister(). So please > remove the #ifdef. > > > > clk_disable_unprepare(hclk); > > clk_disable_unprepare(pclk); > > clk_disable_unprepare(rx_clk); > > @@ -4233,6 +4359,9 @@ static int macb_remove(struct platform_device *pdev) > > pm_runtime_dont_use_autosuspend(&pdev->dev); > > if (!pm_runtime_suspended(&pdev->dev)) { > > clk_disable_unprepare(bp->tx_clk); > > +#ifdef CONFIG_MACB_SIFIVE_FU540 > > + clk_unregister(bp->tx_clk); > > +#endif > > Same here. > > In general try to avoid #ifdef in C code. Will remove all the #ifdef in v3. Thanks for your comments. - Yash