diff mbox series

[v8,1/3] serdev: Add method to assert break signal over tty UART port

Message ID 20230310181921.1437890-2-neeraj.sanjaykale@nxp.com (mailing list archive)
State Superseded
Headers show
Series Add support for NXP bluetooth chipsets | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix fail "Bluetooth: " prefix is not specified in the subject
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Neeraj Sanjay Kale March 10, 2023, 6:19 p.m. UTC
Adds serdev_device_break_ctl() and an implementation for ttyport.
This function simply calls the break_ctl in tty layer, which can
assert a break signal over UART-TX line, if the tty and the
underlying platform and UART peripheral supports this operation.

Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
---
v3: Add details to the commit message. (Greg KH)
---
 drivers/tty/serdev/core.c           | 11 +++++++++++
 drivers/tty/serdev/serdev-ttyport.c | 12 ++++++++++++
 include/linux/serdev.h              |  6 ++++++
 3 files changed, 29 insertions(+)

Comments

bluez.test.bot@gmail.com March 10, 2023, 7:03 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=728841

---Test result---

Test Summary:
CheckPatch                    PASS      5.02 seconds
GitLint                       FAIL      1.42 seconds
SubjectPrefix                 FAIL      0.64 seconds
BuildKernel                   PASS      37.65 seconds
CheckAllWarning               PASS      41.25 seconds
CheckSparse                   PASS      46.81 seconds
CheckSmatch                   PASS      126.67 seconds
BuildKernel32                 PASS      36.91 seconds
TestRunnerSetup               PASS      523.67 seconds
TestRunner_l2cap-tester       PASS      19.02 seconds
TestRunner_iso-tester         PASS      21.05 seconds
TestRunner_bnep-tester        PASS      6.76 seconds
TestRunner_mgmt-tester        PASS      127.35 seconds
TestRunner_rfcomm-tester      PASS      10.91 seconds
TestRunner_sco-tester         PASS      10.12 seconds
TestRunner_ioctl-tester       PASS      11.74 seconds
TestRunner_mesh-tester        PASS      8.86 seconds
TestRunner_smp-tester         PASS      9.65 seconds
TestRunner_userchan-tester    PASS      7.19 seconds
IncrementalBuild              PASS      45.82 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v8,2/3] dt-bindings: net: bluetooth: Add NXP bluetooth support

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
19: B1 Line exceeds max length (87>80): " create mode 100644 Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml"
##############################
Test: SubjectPrefix - FAIL
Desc: Check subject contains "Bluetooth" prefix
Output:
"Bluetooth: " prefix is not specified in the subject
"Bluetooth: " prefix is not specified in the subject


---
Regards,
Linux Bluetooth
Simon Horman March 11, 2023, 12:33 p.m. UTC | #2
On Fri, Mar 10, 2023 at 11:49:19PM +0530, Neeraj Sanjay Kale wrote:
> Adds serdev_device_break_ctl() and an implementation for ttyport.
> This function simply calls the break_ctl in tty layer, which can
> assert a break signal over UART-TX line, if the tty and the
> underlying platform and UART peripheral supports this operation.
> 
> Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
> ---
> v3: Add details to the commit message. (Greg KH)

...

> diff --git a/include/linux/serdev.h b/include/linux/serdev.h
> index 66f624fc618c..c065ef1c82f1 100644
> --- a/include/linux/serdev.h
> +++ b/include/linux/serdev.h

...

> @@ -255,6 +257,10 @@ static inline int serdev_device_set_tiocm(struct serdev_device *serdev, int set,
>  {
>  	return -ENOTSUPP;
>  }
> +static inline int serdev_device_break_ctl(struct serdev_device *serdev, int break_state)
> +{
> +	return -EOPNOTSUPP;

Is the use of -EOPNOTSUPP intentional here?
I see -ENOTSUPP is used elsewhere in this file.

> +}
>  static inline int serdev_device_write(struct serdev_device *sdev, const unsigned char *buf,
>  				      size_t count, unsigned long timeout)
>  {
> -- 
> 2.34.1
>
Neeraj Sanjay Kale March 12, 2023, 7:01 a.m. UTC | #3
Hi Simon

> 
> On Fri, Mar 10, 2023 at 11:49:19PM +0530, Neeraj Sanjay Kale wrote:
> > Adds serdev_device_break_ctl() and an implementation for ttyport.
> > This function simply calls the break_ctl in tty layer, which can
> > assert a break signal over UART-TX line, if the tty and the underlying
> > platform and UART peripheral supports this operation.
> >
> > Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
> > ---
> > v3: Add details to the commit message. (Greg KH)
> 
> ...
> 
> > diff --git a/include/linux/serdev.h b/include/linux/serdev.h index
> > 66f624fc618c..c065ef1c82f1 100644
> > --- a/include/linux/serdev.h
> > +++ b/include/linux/serdev.h
> 
> ...
> 
> > @@ -255,6 +257,10 @@ static inline int serdev_device_set_tiocm(struct
> > serdev_device *serdev, int set,  {
> >       return -ENOTSUPP;
> >  }
> > +static inline int serdev_device_break_ctl(struct serdev_device
> > +*serdev, int break_state) {
> > +     return -EOPNOTSUPP;
> 
> Is the use of -EOPNOTSUPP intentional here?
> I see -ENOTSUPP is used elsewhere in this file.
I was suggested to use - EOPNOTSUPP instead of - ENOTSUPP by the check patch scripts and by Leon Romanovsky.
https://patchwork.kernel.org/project/bluetooth/patch/20230130180504.2029440-2-neeraj.sanjaykale@nxp.com/

ENOTSUPP is not a standard error code and should be avoided in new patches.
See: https://lore.kernel.org/netdev/20200510182252.GA411829@lunn.ch/

> 
> > +}
> >  static inline int serdev_device_write(struct serdev_device *sdev, const
> unsigned char *buf,
> >                                     size_t count, unsigned long
> > timeout)  {
> > --
> > 2.34.1
> >

Thanks,
Neeraj
Simon Horman March 12, 2023, 7:12 p.m. UTC | #4
On Sun, Mar 12, 2023 at 07:01:17AM +0000, Neeraj sanjay kale wrote:
> Hi Simon
> 
> > 
> > On Fri, Mar 10, 2023 at 11:49:19PM +0530, Neeraj Sanjay Kale wrote:
> > > Adds serdev_device_break_ctl() and an implementation for ttyport.
> > > This function simply calls the break_ctl in tty layer, which can
> > > assert a break signal over UART-TX line, if the tty and the underlying
> > > platform and UART peripheral supports this operation.
> > >
> > > Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
> > > ---
> > > v3: Add details to the commit message. (Greg KH)
> > 
> > ...
> > 
> > > diff --git a/include/linux/serdev.h b/include/linux/serdev.h index
> > > 66f624fc618c..c065ef1c82f1 100644
> > > --- a/include/linux/serdev.h
> > > +++ b/include/linux/serdev.h
> > 
> > ...
> > 
> > > @@ -255,6 +257,10 @@ static inline int serdev_device_set_tiocm(struct
> > > serdev_device *serdev, int set,  {
> > >       return -ENOTSUPP;
> > >  }
> > > +static inline int serdev_device_break_ctl(struct serdev_device
> > > +*serdev, int break_state) {
> > > +     return -EOPNOTSUPP;
> > 
> > Is the use of -EOPNOTSUPP intentional here?
> > I see -ENOTSUPP is used elsewhere in this file.
> I was suggested to use - EOPNOTSUPP instead of - ENOTSUPP by the check patch scripts and by Leon Romanovsky.
> https://patchwork.kernel.org/project/bluetooth/patch/20230130180504.2029440-2-neeraj.sanjaykale@nxp.com/
> 
> ENOTSUPP is not a standard error code and should be avoided in new patches.
> See: https://lore.kernel.org/netdev/20200510182252.GA411829@lunn.ch/

Thanks.

I agree that EOPNOTSUPP is preferable.
But my question is if we chose to use it in this case,
even if it is inconsistent with similar code in the same file/API.
If so, then I have no objections.
Neeraj Sanjay Kale March 13, 2023, 4:19 a.m. UTC | #5
Hi Simon

> > >
> > > On Fri, Mar 10, 2023 at 11:49:19PM +0530, Neeraj Sanjay Kale wrote:
> > > > Adds serdev_device_break_ctl() and an implementation for ttyport.
> > > > This function simply calls the break_ctl in tty layer, which can
> > > > assert a break signal over UART-TX line, if the tty and the
> > > > underlying platform and UART peripheral supports this operation.
> > > >
> > > > Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
> > > > ---
> > > > v3: Add details to the commit message. (Greg KH)
> > >
> > > ...
> > >
> > > > diff --git a/include/linux/serdev.h b/include/linux/serdev.h index
> > > > 66f624fc618c..c065ef1c82f1 100644
> > > > --- a/include/linux/serdev.h
> > > > +++ b/include/linux/serdev.h
> > >
> > > ...
> > >
> > > > @@ -255,6 +257,10 @@ static inline int
> > > > serdev_device_set_tiocm(struct serdev_device *serdev, int set,  {
> > > >       return -ENOTSUPP;
> > > >  }
> > > > +static inline int serdev_device_break_ctl(struct serdev_device
> > > > +*serdev, int break_state) {
> > > > +     return -EOPNOTSUPP;
> > >
> > > Is the use of -EOPNOTSUPP intentional here?
> > > I see -ENOTSUPP is used elsewhere in this file.
> > I was suggested to use - EOPNOTSUPP instead of - ENOTSUPP by the check
> patch scripts and by Leon Romanovsky.
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatc
> >
> hwork.kernel.org%2Fproject%2Fbluetooth%2Fpatch%2F20230130180504.202
> 944
> > 0-2-
> neeraj.sanjaykale%40nxp.com%2F&data=05%7C01%7Cneeraj.sanjaykale%40
> >
> nxp.com%7Cf2ae2c9ad3c243df2c1a08db232dc0f1%7C686ea1d3bc2b4c6fa92
> cd99c5
> >
> c301635%7C0%7C0%7C638142451647332825%7CUnknown%7CTWFpbGZsb3
> d8eyJWIjoiM
> >
> C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000
> %7C%7C
> > %7C&sdata=6cF0gipe4kkwYI6txo0vs8vnmF8azCO6gxQ%2F6Tdyd%2Fw%3D
> &reserved=
> > 0
> >
> > ENOTSUPP is not a standard error code and should be avoided in new
> patches.
> > See:
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
> > .kernel.org%2Fnetdev%2F20200510182252.GA411829%40lunn.ch%2F&data
> =05%7C
> >
> 01%7Cneeraj.sanjaykale%40nxp.com%7Cf2ae2c9ad3c243df2c1a08db232dc0f
> 1%7C
> >
> 686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638142451647332825%
> 7CUnknow
> >
> n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1ha
> WwiLC
> >
> JXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=wFgYY6VnZ8BBn6Wme8%2BYj
> aJRy98qyPnUy
> > XC8iCFCv5k%3D&reserved=0
> 
> Thanks.
> 
> I agree that EOPNOTSUPP is preferable.
> But my question is if we chose to use it in this case, even if it is inconsistent
> with similar code in the same file/API.
> If so, then I have no objections.

No, it was just to satisfy the check patch error and Leon's comment. The driver is happy to check if the serdev returned success or not, and simply print the error code during driver debug.
Do you think this should be reverted to ENOTSUPP to maintain consistency?

Thanks,
Neeraj
Simon Horman March 13, 2023, 12:06 p.m. UTC | #6
On Mon, Mar 13, 2023 at 04:19:59AM +0000, Neeraj sanjay kale wrote:
> Hi Simon
> 
> > > >
> > > > On Fri, Mar 10, 2023 at 11:49:19PM +0530, Neeraj Sanjay Kale wrote:
> > > > > Adds serdev_device_break_ctl() and an implementation for ttyport.
> > > > > This function simply calls the break_ctl in tty layer, which can
> > > > > assert a break signal over UART-TX line, if the tty and the
> > > > > underlying platform and UART peripheral supports this operation.
> > > > >
> > > > > Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
> > > > > ---
> > > > > v3: Add details to the commit message. (Greg KH)
> > > >
> > > > ...
> > > >
> > > > > diff --git a/include/linux/serdev.h b/include/linux/serdev.h index
> > > > > 66f624fc618c..c065ef1c82f1 100644
> > > > > --- a/include/linux/serdev.h
> > > > > +++ b/include/linux/serdev.h
> > > >
> > > > ...
> > > >
> > > > > @@ -255,6 +257,10 @@ static inline int
> > > > > serdev_device_set_tiocm(struct serdev_device *serdev, int set,  {
> > > > >       return -ENOTSUPP;
> > > > >  }
> > > > > +static inline int serdev_device_break_ctl(struct serdev_device
> > > > > +*serdev, int break_state) {
> > > > > +     return -EOPNOTSUPP;
> > > >
> > > > Is the use of -EOPNOTSUPP intentional here?
> > > > I see -ENOTSUPP is used elsewhere in this file.
> > > I was suggested to use - EOPNOTSUPP instead of - ENOTSUPP by the check
> > patch scripts and by Leon Romanovsky.
> > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatc
> > >
> > hwork.kernel.org%2Fproject%2Fbluetooth%2Fpatch%2F20230130180504.202
> > 944
> > > 0-2-
> > neeraj.sanjaykale%40nxp.com%2F&data=05%7C01%7Cneeraj.sanjaykale%40
> > >
> > nxp.com%7Cf2ae2c9ad3c243df2c1a08db232dc0f1%7C686ea1d3bc2b4c6fa92
> > cd99c5
> > >
> > c301635%7C0%7C0%7C638142451647332825%7CUnknown%7CTWFpbGZsb3
> > d8eyJWIjoiM
> > >
> > C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000
> > %7C%7C
> > > %7C&sdata=6cF0gipe4kkwYI6txo0vs8vnmF8azCO6gxQ%2F6Tdyd%2Fw%3D
> > &reserved=
> > > 0
> > >
> > > ENOTSUPP is not a standard error code and should be avoided in new
> > patches.
> > > See:
> > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
> > > .kernel.org%2Fnetdev%2F20200510182252.GA411829%40lunn.ch%2F&data
> > =05%7C
> > >
> > 01%7Cneeraj.sanjaykale%40nxp.com%7Cf2ae2c9ad3c243df2c1a08db232dc0f
> > 1%7C
> > >
> > 686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638142451647332825%
> > 7CUnknow
> > >
> > n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1ha
> > WwiLC
> > >
> > JXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=wFgYY6VnZ8BBn6Wme8%2BYj
> > aJRy98qyPnUy
> > > XC8iCFCv5k%3D&reserved=0
> > 
> > Thanks.
> > 
> > I agree that EOPNOTSUPP is preferable.
> > But my question is if we chose to use it in this case, even if it is inconsistent
> > with similar code in the same file/API.
> > If so, then I have no objections.
> 
> No, it was just to satisfy the check patch error and Leon's comment. The driver is happy to check if the serdev returned success or not, and simply print the error code during driver debug.
> Do you think this should be reverted to ENOTSUPP to maintain consistency?

My _opinion_, is that first prize would be converting existing instances
of ENOTSUPP in this file to EOPNOTSUPP. And then use EOPNOTSUPP going
forward. And that second prize would be for your patch to use ENOTSUPP.
Because I think there is a value consistency.

But I do see why you have done things the way you have.
And I don't necessarily think it is wrong.
Neeraj Sanjay Kale March 13, 2023, 2:14 p.m. UTC | #7
Hi Simon,

> > > > > > diff --git a/include/linux/serdev.h b/include/linux/serdev.h
> > > > > > index
> > > > > > 66f624fc618c..c065ef1c82f1 100644
> > > > > > --- a/include/linux/serdev.h
> > > > > > +++ b/include/linux/serdev.h
> > > > >
> > > > > ...
> > > > >
> > > > > > @@ -255,6 +257,10 @@ static inline int
> > > > > > serdev_device_set_tiocm(struct serdev_device *serdev, int set,  {
> > > > > >       return -ENOTSUPP;
> > > > > >  }
> > > > > > +static inline int serdev_device_break_ctl(struct
> > > > > > +serdev_device *serdev, int break_state) {
> > > > > > +     return -EOPNOTSUPP;
> > > > >
> > > > > Is the use of -EOPNOTSUPP intentional here?
> > > > > I see -ENOTSUPP is used elsewhere in this file.
> > > > I was suggested to use - EOPNOTSUPP instead of - ENOTSUPP by the
> > > > check
> > > patch scripts and by Leon Romanovsky.
> > > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
> > > >
> patc%2F&data=05%7C01%7Cneeraj.sanjaykale%40nxp.com%7Cd6011072c88
> 94
> > > >
> b141a3008db23bb5bc0%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0
> %7C6
> > > >
> 38143059832335354%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwM
> DAiLCJQ
> > > >
> IjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata
> =k
> > > >
> gk6w%2Fn2d3rNx%2FXe1rLfN0U%2BeTBJTxztSRUEUW2Noqk%3D&reserved=
> 0
> > > >
> > >
> hwork.kernel.org%2Fproject%2Fbluetooth%2Fpatch%2F20230130180504.202
> > > 944
> > > > 0-2-
> > >
> neeraj.sanjaykale%40nxp.com%2F&data=05%7C01%7Cneeraj.sanjaykale%40
> > > >
> > >
> nxp.com%7Cf2ae2c9ad3c243df2c1a08db232dc0f1%7C686ea1d3bc2b4c6fa92
> > > cd99c5
> > > >
> > >
> c301635%7C0%7C0%7C638142451647332825%7CUnknown%7CTWFpbGZsb3
> > > d8eyJWIjoiM
> > > >
> > >
> C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000
> > > %7C%7C
> > > > %7C&sdata=6cF0gipe4kkwYI6txo0vs8vnmF8azCO6gxQ%2F6Tdyd%2Fw%
> 3D
> > > &reserved=
> > > > 0
> > > >
> > > > ENOTSUPP is not a standard error code and should be avoided in new
> > > patches.
> > > > See:
> > > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
> > > >
> lore%2F&data=05%7C01%7Cneeraj.sanjaykale%40nxp.com%7Cd6011072c88
> 94
> > > >
> b141a3008db23bb5bc0%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0
> %7C6
> > > >
> 38143059832335354%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwM
> DAiLCJQ
> > > >
> IjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata
> =9
> > > >
> wojVR7aEgzoeajvy%2FMAkSqAYGBkxrJZtyxlvIpeZ%2Bw%3D&reserved=0
> > > > .kernel.org%2Fnetdev%2F20200510182252.GA411829%40lunn.ch%2F&
> data
> > > =05%7C
> > > >
> > >
> 01%7Cneeraj.sanjaykale%40nxp.com%7Cf2ae2c9ad3c243df2c1a08db232dc0f
> > > 1%7C
> > > >
> > >
> 686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638142451647332825%
> > > 7CUnknow
> > > >
> > >
> n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1ha
> > > WwiLC
> > > >
> > >
> JXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=wFgYY6VnZ8BBn6Wme8%2BYj
> > > aJRy98qyPnUy
> > > > XC8iCFCv5k%3D&reserved=0
> > >
> > > Thanks.
> > >
> > > I agree that EOPNOTSUPP is preferable.
> > > But my question is if we chose to use it in this case, even if it is
> > > inconsistent with similar code in the same file/API.
> > > If so, then I have no objections.
> >
> > No, it was just to satisfy the check patch error and Leon's comment. The
> driver is happy to check if the serdev returned success or not, and simply
> print the error code during driver debug.
> > Do you think this should be reverted to ENOTSUPP to maintain consistency?
> 
> My _opinion_, is that first prize would be converting existing instances of
> ENOTSUPP in this file to EOPNOTSUPP. And then use EOPNOTSUPP going
> forward. And that second prize would be for your patch to use ENOTSUPP.
> Because I think there is a value consistency.
> 
> But I do see why you have done things the way you have.
> And I don't necessarily think it is wrong.

When you put it that way, how can I say no to a first prize! :D
I have replaced all instances of ENOTSUPP with EOPNOTSUPP in these 2 files after making sure none of the functions returning it has a check for ENOTSUPP.
It seems most of the instances do not check for a return value anyways.
Please check v9 patch for the changes.

Thanks
Neeraj
diff mbox series

Patch

diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 0180e1e4e75d..f2fdd6264e5d 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -405,6 +405,17 @@  int serdev_device_set_tiocm(struct serdev_device *serdev, int set, int clear)
 }
 EXPORT_SYMBOL_GPL(serdev_device_set_tiocm);
 
+int serdev_device_break_ctl(struct serdev_device *serdev, int break_state)
+{
+	struct serdev_controller *ctrl = serdev->ctrl;
+
+	if (!ctrl || !ctrl->ops->break_ctl)
+		return -EOPNOTSUPP;
+
+	return ctrl->ops->break_ctl(ctrl, break_state);
+}
+EXPORT_SYMBOL_GPL(serdev_device_break_ctl);
+
 static int serdev_drv_probe(struct device *dev)
 {
 	const struct serdev_device_driver *sdrv = to_serdev_device_driver(dev->driver);
diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
index d367803e2044..9888673744af 100644
--- a/drivers/tty/serdev/serdev-ttyport.c
+++ b/drivers/tty/serdev/serdev-ttyport.c
@@ -247,6 +247,17 @@  static int ttyport_set_tiocm(struct serdev_controller *ctrl, unsigned int set, u
 	return tty->ops->tiocmset(tty, set, clear);
 }
 
+static int ttyport_break_ctl(struct serdev_controller *ctrl, unsigned int break_state)
+{
+	struct serport *serport = serdev_controller_get_drvdata(ctrl);
+	struct tty_struct *tty = serport->tty;
+
+	if (!tty->ops->break_ctl)
+		return -EOPNOTSUPP;
+
+	return tty->ops->break_ctl(tty, break_state);
+}
+
 static const struct serdev_controller_ops ctrl_ops = {
 	.write_buf = ttyport_write_buf,
 	.write_flush = ttyport_write_flush,
@@ -259,6 +270,7 @@  static const struct serdev_controller_ops ctrl_ops = {
 	.wait_until_sent = ttyport_wait_until_sent,
 	.get_tiocm = ttyport_get_tiocm,
 	.set_tiocm = ttyport_set_tiocm,
+	.break_ctl = ttyport_break_ctl,
 };
 
 struct device *serdev_tty_port_register(struct tty_port *port,
diff --git a/include/linux/serdev.h b/include/linux/serdev.h
index 66f624fc618c..c065ef1c82f1 100644
--- a/include/linux/serdev.h
+++ b/include/linux/serdev.h
@@ -92,6 +92,7 @@  struct serdev_controller_ops {
 	void (*wait_until_sent)(struct serdev_controller *, long);
 	int (*get_tiocm)(struct serdev_controller *);
 	int (*set_tiocm)(struct serdev_controller *, unsigned int, unsigned int);
+	int (*break_ctl)(struct serdev_controller *ctrl, unsigned int break_state);
 };
 
 /**
@@ -202,6 +203,7 @@  int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_
 void serdev_device_wait_until_sent(struct serdev_device *, long);
 int serdev_device_get_tiocm(struct serdev_device *);
 int serdev_device_set_tiocm(struct serdev_device *, int, int);
+int serdev_device_break_ctl(struct serdev_device *serdev, int break_state);
 void serdev_device_write_wakeup(struct serdev_device *);
 int serdev_device_write(struct serdev_device *, const unsigned char *, size_t, long);
 void serdev_device_write_flush(struct serdev_device *);
@@ -255,6 +257,10 @@  static inline int serdev_device_set_tiocm(struct serdev_device *serdev, int set,
 {
 	return -ENOTSUPP;
 }
+static inline int serdev_device_break_ctl(struct serdev_device *serdev, int break_state)
+{
+	return -EOPNOTSUPP;
+}
 static inline int serdev_device_write(struct serdev_device *sdev, const unsigned char *buf,
 				      size_t count, unsigned long timeout)
 {