Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENOSYS has ambiguous meaning. #11207

Closed
Mierunski opened this issue Nov 8, 2018 · 3 comments
Closed

ENOSYS has ambiguous meaning. #11207

Mierunski opened this issue Nov 8, 2018 · 3 comments
Labels
Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug

Comments

@Mierunski
Copy link
Collaborator

In the errno.h file, we can find:

#define ENOSYS 71 /* Function not implemented */

While checkpatch gives following information:

WARNING:ENOSYS: ENOSYS means 'invalid syscall nr' and nothing else

i.e. I wanted to use it in the following way:

__syscall int uart_configure(struct device *dev, struct uart_config *cfg);

static inline int _impl_uart_configure(struct device *dev,
				       struct uart_config *cfg)
{
	const struct uart_driver_api *api =
				(const struct uart_driver_api *)dev->driver_api;

	if (api->configure) {
		return api->configure(dev, cfg);
	}
	return -ENOSYS;
}

Where
-ENOSYS If driver has not implemented this function
-ENOTSUP If device does not support given configuration.

Which information if true? errno.h file or checkpatch?

@himanshujha199640
Copy link
Collaborator

In linux kernel's context from where checkpatch.pl is actually derived:

torvalds/linux@e15f431
torvalds/linux@91c9afa

But grepping through Zephyr sources:

himanshu@himanshu-Vostro-3559:~/zephyr$ git grep -w "ENOSYS"
drivers/led_strip/ws2812b_sw.c: return -ENOSYS;
ext/hal/libmetal/libmetal/lib/system/linux/init.c:              return -ENOSYS;
ext/hal/libmetal/libmetal/lib/system/linux/utilities.c:         return -ENOSYS;
lib/libc/minimal/include/errno.h:#define ENOSYS 71 /* Function not implemented */
scripts/checkpatch.pl:# ENOSYS means "bad syscall nr" and nothing else.  This will have a small
scripts/checkpatch.pl:                  WARN("ENOSYS",
scripts/checkpatch.pl:                       "ENOSYS means 'invalid syscall nr' and nothing else\n" . $herecurr);
tests/bluetooth/bluetooth/src/bluetooth.c:#define EXPECTED_ERROR -ENOSYS

So, I believe errno.h is correct here!

@pfalcon
Copy link
Contributor

pfalcon commented Nov 13, 2018

Where
-ENOSYS If driver has not implemented this function
-ENOTSUP If device does not support given configuration.

Note that this doesn't correspond to how "driver multiplexor APIs" (spi, i2c, etc.) currently work. If that is to be changed, it should be changed consistently for all APIs. (Low priority IMHO considering all other tasks we have.)

@nashif nashif added the bug The issue is a bug, or the PR is fixing a bug label Nov 13, 2018
@galak galak added the priority: low Low impact/importance bug label Nov 20, 2018
@nashif nashif added Enhancement Changes/Updates/Additions to existing features and removed bug The issue is a bug, or the PR is fixing a bug labels Mar 3, 2019
@mnkp
Copy link
Member

mnkp commented Apr 30, 2021

The issue has been addressed by #33887. I believe we can close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

6 participants