From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30788EB64DC for ; Mon, 3 Jul 2023 13:39:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231567AbjGCNjM (ORCPT ); Mon, 3 Jul 2023 09:39:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjGCNjJ (ORCPT ); Mon, 3 Jul 2023 09:39:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C6DAFF for ; Mon, 3 Jul 2023 06:39:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 29FE660F3C for ; Mon, 3 Jul 2023 13:39:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89553C433C8; Mon, 3 Jul 2023 13:38:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1688391547; bh=5BHJbjZKEETjKoB5GMWkncTJkxJQC1SM5qkWcI1ACqs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1lzI9OYKSgXX0ZMNbeTJuWljSDayrIsaavvPs86Pq2IQkzIDcyeL8+m5dum8tBg8M 4JiyI6DIFUThem1z1+Q1twtZZqJ0zPT7v3C92/STXefGAYTVeBHSKH1AoUaOkIuPOb fyZDruYRhPRX0JJ7oWIyJWnSKVEGzXzymgf5zPeI= Date: Mon, 3 Jul 2023 15:38:42 +0200 From: Greg Kroah-Hartman To: Rodolfo Giometti Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define Message-ID: <2023070327-gangway-comic-6e15@gregkh> References: <20230630071826.105501-1-giometti@enneenne.com> <20230630071826.105501-2-giometti@enneenne.com> <2023063017-traverse-accustom-97f4@gregkh> <56e461b4-2cd8-ec89-86b2-68544826cf73@enneenne.com> <2023063015-immerse-broadside-3dab@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 30, 2023 at 03:29:50PM +0200, Rodolfo Giometti wrote: > On 30/06/23 14:53, Greg Kroah-Hartman wrote: > > On Fri, Jun 30, 2023 at 09:50:33AM +0200, Rodolfo Giometti wrote: > > > On 30/06/23 09:31, Greg Kroah-Hartman wrote: > > > > On Fri, Jun 30, 2023 at 09:18:26AM +0200, Rodolfo Giometti wrote: > > > > > Userspace PPS clients should not known about how many PPS sources can > > > > > be defined within the system (nor the rfc2783 say so), so we can > > > > > safely drop this define since is not used anymore in the kernel too. > > > > > > > > > > Signed-off-by: Rodolfo Giometti > > > > > --- > > > > > drivers/pps/pps.c | 6 +++--- > > > > > include/uapi/linux/pps.h | 1 - > > > > > 2 files changed, 3 insertions(+), 4 deletions(-) > > > > > > > > > > diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c > > > > > index 5d19baae6a38..1a6131608036 100644 > > > > > --- a/drivers/pps/pps.c > > > > > +++ b/drivers/pps/pps.c > > > > > @@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps) > > > > > * Get new ID for the new PPS source. After idr_alloc() calling > > > > > * the new source will be freely available into the kernel. > > > > > */ > > > > > - err = idr_alloc(&pps_idr, pps, 0, PPS_MAX_SOURCES, GFP_KERNEL); > > > > > + err = idr_alloc(&pps_idr, pps, 0, MINORMASK, GFP_KERNEL); > > > > > if (err < 0) { > > > > > if (err == -ENOSPC) { > > > > > pr_err("%s: too many PPS sources in the system\n", > > > > > @@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); > > > > > static void __exit pps_exit(void) > > > > > { > > > > > class_destroy(pps_class); > > > > > - unregister_chrdev_region(pps_devt, PPS_MAX_SOURCES); > > > > > + unregister_chrdev_region(pps_devt, MINORMASK); > > > > > } > > > > > static int __init pps_init(void) > > > > > @@ -463,7 +463,7 @@ static int __init pps_init(void) > > > > > } > > > > > pps_class->dev_groups = pps_groups; > > > > > - err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps"); > > > > > + err = alloc_chrdev_region(&pps_devt, 0, MINORMASK, "pps"); > > > > > if (err < 0) { > > > > > pr_err("failed to allocate char device region\n"); > > > > > goto remove_class; > > > > > diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h > > > > > index 90f2e86020ba..8a4096f18af1 100644 > > > > > --- a/include/uapi/linux/pps.h > > > > > +++ b/include/uapi/linux/pps.h > > > > > @@ -26,7 +26,6 @@ > > > > > #include > > > > > #define PPS_VERSION "5.3.6" > > > > > -#define PPS_MAX_SOURCES MINORMASK > > > > > > > > Why change this in patch 1, and then delete this here? > > > > > > > > That makes no sense. > > > > > > I did it in two steps to be clear that the first step is about a better > > > redefinition of the PPS_MAX_SOURCES define, while the second step is about > > > the fact it's now that define is useless. > > > > Better to just convert everything in patch one, and then in patch 2 > > delete the .h #define. That way, when userspace breaks, you can revert > > just the last patch :) > > I'm puzzled since I did as you say... patch 1/2 increases PPS_MAX_SOURCES > value while patch 2/2 drops PPS_MAX_SOURCES define. Ah, I thought patch 1/2 renamed it. But why increase it if you are removing it? > > > > And if this is exported to userspace, removing it should break things, > > > > right? If not, why was it there in the first place? > > > > > > In reality such define is not stated within the PPS RFC2783, so userspace > > > programs whose relies on such define are broken. > > > > RFC's do not document Linux kernel apis. > > It's true, but well written PPS clients should relay only on PPS API which > in turn doesn't states that define. :P Are you sure? Have you audited the clients? if so, please document that in the changelog text. > > So if any userspace code breaks, you have to put this back, sorry. > > If you think that patch 2 is not good, no problem, just drop it, but please > just consider applying patch 1, since increasing PPS_MAX_SOURCES value is > good. You can't change a uapi value either without breaking things :( thanks, greg k-h