mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@enneenne.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Date: Fri, 30 Jun 2023 15:29:50 +0200	[thread overview]
Message-ID: <ca137a28-28a3-f563-52e9-4ee0ef1daa9f@enneenne.com> (raw)
In-Reply-To: <2023063015-immerse-broadside-3dab@gregkh>

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 <giometti@enneenne.com>
>>>> ---
>>>>    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 <linux/types.h>
>>>>    #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.

>>> 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

> 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.

Ciao,

Rodolfo

-- 
GNU/Linux Solutions                  e-mail: giometti@enneenne.com
Linux Device Driver                          giometti@linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti


  reply	other threads:[~2023-06-30 13:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30  7:18 [PATCH 1/2] include/uapi pps.h: increase PPS_MAX_SOURCES value Rodolfo Giometti
2023-06-30  7:18 ` [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define Rodolfo Giometti
2023-06-30  7:31   ` Greg Kroah-Hartman
2023-06-30  7:50     ` Rodolfo Giometti
2023-06-30 12:53       ` Greg Kroah-Hartman
2023-06-30 13:29         ` Rodolfo Giometti [this message]
2023-07-03 13:38           ` Greg Kroah-Hartman
2023-07-03 14:47             ` Rodolfo Giometti
2023-07-17 15:52               ` Charlie Johnston
2023-07-18  7:47                 ` Rodolfo Giometti
2023-08-08 17:58                   ` Charlie Johnston
2023-08-09  7:12                     ` Rodolfo Giometti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca137a28-28a3-f563-52e9-4ee0ef1daa9f@enneenne.com \
    --to=giometti@enneenne.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®