Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1447130ybz; Sat, 25 Apr 2020 19:43:54 -0700 (PDT) X-Google-Smtp-Source: APiQypJ0wm9FzO+qhE8J2h7fpJ7S9pbCq70BfwuVs9l3Ep8zbHzBiK9iYPnCDP9gzrhNjTuqae9z X-Received: by 2002:a17:906:855a:: with SMTP id h26mr14293668ejy.56.1587869033896; Sat, 25 Apr 2020 19:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587869033; cv=none; d=google.com; s=arc-20160816; b=OL3wQlHw8Hgs47wKEK2eNv/bCubpdUhs1dndnbmidMdkKeoDOQbRsUViFIK26mFrQt 6wiR2iGenIptAMft74OV4gIDVY+7Edyhgv5Tp08hJnziIjuZ62KC6TL7aqiB2QR0QC0q DZHxE9yVAe57OfteALztY3vdwQA/O8+31Rp+1jdIHaPbzvOiPKU8iqi0L/8m0hpxbBS4 3eHFjMeXUZBUlEf0b9S1RM4z4rdvRfgT9iwMMDfHTmPDcSvcJsAQEKPgCcZiDmcjdHm7 DiE2BpQkoKesA3Y5PnsoMIvA3dygkVYYv4hrox5rF47NmyJnN8ZSwQM4woWu913fxFd1 2iTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8IYtAFbciShiT0fdAfMZ7efWbaDf5FVfgYocgiOQmLY=; b=HOoMLyfr8c6dopWuZ494yBvAKrzm41lqQAmsnqb5w+fmc+5POlOUNr56qXR6txYflC gvxTrVayx4eEm6mhEoxKLuUxZWGwWUAOaJVQBZfgTnOAwuepgCDldekdBmsz41vEZ5Lu FqRzelFP99aj3M3LjZycq1FwfR/hUfv9CiPETtAsEM9+AQXi2O+FTVBtt+QFkxDIQKMc f+PHUC2zbVF/rabw/XUQXHf7z+MAAD4g65wakCxOqjy7ELBtTkEDMG3zAefybW60mnN9 xoBfsTkLquoeLh5zopmWwLQuWVq4alnpVEoM4B59zBfaOd6KlT4qKbXJ8HdhDh179U4M bYrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@daemons-net.20150623.gappssmtp.com header.s=20150623 header.b=pzZUWK2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 qt4si5640167ejb.447.2020.04.25.19.43.28; Sat, 25 Apr 2020 19:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@daemons-net.20150623.gappssmtp.com header.s=20150623 header.b=pzZUWK2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726140AbgDZCmB (ORCPT + 99 others); Sat, 25 Apr 2020 22:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726108AbgDZCl7 (ORCPT ); Sat, 25 Apr 2020 22:41:59 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 362C1C09B04F for ; Sat, 25 Apr 2020 19:41:58 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id 145so6966092pfw.13 for ; Sat, 25 Apr 2020 19:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daemons-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8IYtAFbciShiT0fdAfMZ7efWbaDf5FVfgYocgiOQmLY=; b=pzZUWK2zE3hDKPt0z+xKXHSnYR5OsS66t3vLlXJdGANDheH4kv3ix2G7IwwIfuM/++ 5cx+gvqppJ7Sw9M9gr67rXDNiV9ZBcy87U30CzoqgLnT1bofMIpVfFcBhnTOU0srlMiB 14ahowJMGii7i3/TcN4bmLIAbz6dRnUDgZwF2eWv+iYYegH7WJQEEWsWPbANIE+fxQyN qzU3Zb6hlWv4PuQfdZ+RBs4Hh8tnh/52iVG04WpcV3xamYthlY8mLoFfASV1u+NR8Hwv u+gok2cabH2OyWHTzPU7NoyIwPgAYV09NyQy1SxMjU8t70QtLfcsfYSUlV69pTZ+MhEQ Jy5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8IYtAFbciShiT0fdAfMZ7efWbaDf5FVfgYocgiOQmLY=; b=MC8pTH9QIaP2J/nbyiAqoh4k92UD2M05zoreQJHkNgdxU3JKbO2f5BPr/2JblKoVGT vAYDTVhHn8FdWSnSQXFAwTuhZZyWciv4HO7xg3s7G37hHL+hjaBN9ALphvdoQumITxCl dQYY0c6pJo5Zm8lroFRx4wmx0QTCtHe2fXWiIuHmKy3jzki6h/4RJCNYDuV3zS63AHHp OeyqLHDd/SxBBTdg5c5HPeWm7Uzxwj+zgI1I0yhR+s8dzSoJHoooIwynZx9WbEYWL9ht PvBR9tsPoJsMRiK9lBWTv4ifapmC6uUDZ3YZXBuZMenBozy6QhMqeW+Bxlu9yoGptc2H OPXg== X-Gm-Message-State: AGi0PuZggSDfOz8i7hb0ixfGhxmipCswlqBVorDs3e0sfktWKH2zfJyB VI7O+aw8cVv4t5+y5ksYxUjf X-Received: by 2002:a63:7901:: with SMTP id u1mr16081297pgc.409.1587868917553; Sat, 25 Apr 2020 19:41:57 -0700 (PDT) Received: from arctic-shiba-lx ([47.156.151.166]) by smtp.gmail.com with ESMTPSA id 13sm9074035pfv.95.2020.04.25.19.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Apr 2020 19:41:56 -0700 (PDT) Date: Sat, 25 Apr 2020 19:41:48 -0700 From: Clay McClure To: Grygorii Strashko Cc: Arnd Bergmann , Richard Cochran , "David S. Miller" , Sekhar Nori , Networking , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] net: cpts: Condition WARN_ON on PTP_1588_CLOCK Message-ID: <20200426024148.GA7518@arctic-shiba-lx> References: <6fef3a00-6c18-b775-d1b4-dfd692261bd3@ti.com> <20200420093610.GA28162@arctic-shiba-lx> <20200420170051.GB11862@localhost> <20200420211819.GA16930@localhost> <20200420213406.GB20996@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 02:16:11PM +0300, Grygorii Strashko wrote: > > On 21/04/2020 00:42, Arnd Bergmann wrote: > > > > On Mon, Apr 20, 2020 at 11:34 PM Richard Cochran > > > > > > To be clear, do you all see a need to change the stubbed version of > > > ptp_clock_register() or not? > > > > No, if the NULL return is only meant to mean "nothing wrong, keep going > > wihtout an object", that's fine with me. It does occasionally confuse driver > > writers (as seen here), so it's not a great interface, but there is no general > > solution to make it better. That's why in my first patch I condition the WARN_ON() on PTP_1588_CLOCK, since without that the null pointer here is not an error: void cpts_unregister(struct cpts *cpts) { if (WARN_ON(!cpts->clock)) return; Grygorii's question (paraphrasing: "why would you ever do that?") prompted my second patch, making the broken configuration obvious by emitting an error during `ifup`, instead of just a warning during `ifdown`. But I think Grygorii is on to something here: > Another question is that CPTS completely nonfunctional in this case and > it was never expected that somebody will even try to use/run such > configuration (except for random build purposes). So, let's not allow it. In my view, commit d1cbfd771ce8 ("ptp_clock: Allow for it to be optional") went a bit too far, and converted even clearly PTP-specific modules from `select` to `imply` PTP_1588_CLOCK, which is what made this broken configuration possible. I suggest reverting that change, just for the PTP-specific modules under drivers/net/ethernet. I audited all drivers that call `ptp_clock_register()`; it looks like these should `select` (instead of merely `imply`) PTP_1588_CLOCK: NET_DSA_MV88E6XXX_PTP NET_DSA_SJA1105_PTP MACB_USE_HWSTAMP CAVIUM_PTP TI_CPTS_MOD PTP_1588_CLOCK_IXP46X Note how they all reference PTP or timestamping in their name, which is a clue that they depend on PTP_1588_CLOCK. I have a patch for this, but first, a procedural question: does mailing list etiquette dictate that I reply to this thread with the new patch, or does it begin a new thread? -- Clay