From patchwork Mon Sep 19 14:10:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 76545 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp981982qgf; Mon, 19 Sep 2016 07:10:38 -0700 (PDT) X-Received: by 10.202.81.19 with SMTP id f19mr29750269oib.89.1474294238163; Mon, 19 Sep 2016 07:10:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c83si35279876oib.258.2016.09.19.07.10.37; Mon, 19 Sep 2016 07:10:38 -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=@linaro.org; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938901AbcISOKb (ORCPT + 27 others); Mon, 19 Sep 2016 10:10:31 -0400 Received: from mail-qt0-f172.google.com ([209.85.216.172]:32948 "EHLO mail-qt0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756134AbcISOKY (ORCPT ); Mon, 19 Sep 2016 10:10:24 -0400 Received: by mail-qt0-f172.google.com with SMTP id 11so72074181qtc.0 for ; Mon, 19 Sep 2016 07:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=Nbs9PbsZKVLlsTVO2ObkeGd0qESABQ4e28oULy91B/M=; b=Qon0/Q8Funf2DnYQQXe+5phbudR6eA8gDn5Jx40CiWG1ntquOnQXaXeu40pta9IH6V e2i3g+mAYNcgrGYQYDmP7gtejWHwi5t31ZXZ5rvsnpSt3L8GNwZkGZpbkevhMZY13AAL vGEiaTd1MM5BAkK2rorucF/3iLZCia2yJwyOo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=Nbs9PbsZKVLlsTVO2ObkeGd0qESABQ4e28oULy91B/M=; b=PDuQCG8p2kkbhdHXjps/eOwXOUuEESKlQR7MGmVAvi+4j/K1GAOzpcfIkX2NH3PzG8 ApoZ0xoKcD8Px4LVstFxLcA2f1ca+hch27KrhYFLl0aQpiZylNopMf27Jr5KFuIW7ZPb bZ0a7KbSkui0ALOKwXzYJXcDdVJT8gceRm3RKKdEj0Ka1cwZmVUNsyRXlr8xAd7Rxtmd Z88KWsraZ+P0topoO4pO8uK70dgHCHm6UA9AXKzXuzGQabAL0MABeAvRQ8DHz6Qv2sRR jvc0XkSRCObQzUGdHVAL7XHnnkKdPlBsYLIY5fsijEJWDOvbFKBsYmvAR9xH7N4qfEiQ d29Q== X-Gm-Message-State: AE9vXwMxTGU2ffwHsNXceh9Rds/aFe/kf0Jf+meqsmClmDrWxEglUB/Az14c1UhdLLalEWC9 X-Received: by 10.237.43.163 with SMTP id e32mr30425788qtd.124.1474294223857; Mon, 19 Sep 2016 07:10:23 -0700 (PDT) Received: from xanadu.home ([2607:fa48:6e39:d410:feaa:14ff:fea7:ed77]) by smtp.gmail.com with ESMTPSA id 14sm13107435qtp.6.2016.09.19.07.10.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Sep 2016 07:10:23 -0700 (PDT) Date: Mon, 19 Sep 2016 10:10:21 -0400 (EDT) From: Nicolas Pitre To: Jiri Benc cc: John Stultz , Thomas Gleixner , Richard Cochran , Josh Triplett , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] ptp_clock: allow for it to be optional In-Reply-To: <20160919142553.3fb682ba@griffin> Message-ID: References: <1474257070-4255-1-git-send-email-nicolas.pitre@linaro.org> <1474257070-4255-2-git-send-email-nicolas.pitre@linaro.org> <20160919142553.3fb682ba@griffin> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 19 Sep 2016, Jiri Benc wrote: > On Sun, 18 Sep 2016 23:51:09 -0400, Nicolas Pitre wrote: > > And to make it possible for PTP to be configured out, the select statement > > in the Kconfig entry for those ethernet drivers is changed from selecting > > PTP_1588_CLOCK to PTP_1588_CLOCK_SELECTED whose purpose is to indicate the > > default Kconfig value for the PTP subsystem. > > With this patch applied, the user is free to set a NIC driver as built > in and PTP_1588_CLOCK as a module, right? If so, that would lead to > non-functional PTP without any warning due to the use of IS_REACHABLE. > That doesn't sound right. Could easily cause hours of headache to > someone. > > Or is this handled somehow? I don't see how to remove the ability to select m for PTP_1588_CLOCK based on (PTP_1588_CLOCK_SELECTED = y). What about this on top then: diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h index 4c29eb8e53..74079b2fcf 100644 --- a/include/linux/ptp_clock_kernel.h +++ b/include/linux/ptp_clock_kernel.h @@ -207,7 +207,16 @@ int ptp_find_pin(struct ptp_clock *ptp, #else static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, struct device *parent) -{ return NULL; } +{ + if (IS_MODULE(CONFIG_PTP_1588_CLOCK)) { + pr_warn("%s is built-in while PTP clock subsystem is modular, " + "PTP clock ignored\n", KBUILD_MODNAME); + } else { + pr_warn("ignoring PTP clock from %s as PTP clock subsystem " + "is configured out\n", KBUILD_MODNAME); + } + return NULL; +} static inline int ptp_clock_unregister(struct ptp_clock *ptp) { return 0; } static inline void ptp_clock_event(struct ptp_clock *ptp,