[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zfdxmf7h.ffs@tglx>
Date: Tue, 24 Jun 2025 15:39:14 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Paolo Abeni <pabeni@...hat.com>, LKML <linux-kernel@...r.kernel.org>
Cc: Richard Cochran <richardcochran@...il.com>, netdev@...r.kernel.org
Subject: Re: [patch 08/13] ptp: Split out PTP_PIN_GETFUNC ioctl code
On Tue, Jun 24 2025 at 11:22, Paolo Abeni wrote:
> On 6/20/25 3:24 PM, Thomas Gleixner wrote:
>> Continue the ptp_ioctl() cleanup by splitting out the PTP_PIN_GETFUNC ioctl
>> code into a helper function. Convert to lock guard while at it.
>>
>> No functional change intended.
>>
>> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
>> ---
>> drivers/ptp/ptp_chardev.c | 52 ++++++++++++++++++++--------------------------
>> 1 file changed, 23 insertions(+), 29 deletions(-)
>>
>> --- a/drivers/ptp/ptp_chardev.c
>> +++ b/drivers/ptp/ptp_chardev.c
>> @@ -396,6 +396,28 @@ static long ptp_sys_offset(struct ptp_cl
>> return copy_to_user(arg, sysoff, sizeof(*sysoff)) ? -EFAULT : 0;
>> }
>>
>> +static long ptp_pin_getfunc(struct ptp_clock *ptp, unsigned int cmd, void __user *arg)
>> +{
>> + struct ptp_clock_info *ops = ptp->info;
>> + struct ptp_pin_desc pd;
>> +
>> + if (copy_from_user(&pd, arg, sizeof(pd)))
>> + return -EFAULT;
>> +
>> + if (cmd == PTP_PIN_GETFUNC2 && !mem_is_zero(pd.rsv, sizeof(pd.rsv)))
>> + return -EINVAL;
>> + else
>> + memset(pd.rsv, 0, sizeof(pd.rsv));
>
> Minor nit: I personally find the 'else' statement after return
> counter-intuitive and dropping it would save an additional LoC.
Of course ...
Powered by blists - more mailing lists