Commit 7a6038b3 authored by Arnd Bergmann's avatar Arnd Bergmann

compat_ioctl: move hci_sock handlers into driver

All these ioctl commands are compatible, so we can handle
them with a trivial wrapper in hci_sock.c and remove
the listing in fs/compat_ioctl.c.

A few of the commands pass integer arguments instead of
pointers, so for correctness skip the compat_ptr() conversion
here.
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 7d60a7a6
...@@ -40,9 +40,6 @@ ...@@ -40,9 +40,6 @@
#include "internal.h" #include "internal.h"
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_sock.h>
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <linux/fd.h> #include <linux/fd.h>
...@@ -646,27 +643,6 @@ COMPATIBLE_IOCTL(RNDADDENTROPY) ...@@ -646,27 +643,6 @@ COMPATIBLE_IOCTL(RNDADDENTROPY)
COMPATIBLE_IOCTL(RNDZAPENTCNT) COMPATIBLE_IOCTL(RNDZAPENTCNT)
COMPATIBLE_IOCTL(RNDCLEARPOOL) COMPATIBLE_IOCTL(RNDCLEARPOOL)
/* Bluetooth */ /* Bluetooth */
COMPATIBLE_IOCTL(HCIDEVUP)
COMPATIBLE_IOCTL(HCIDEVDOWN)
COMPATIBLE_IOCTL(HCIDEVRESET)
COMPATIBLE_IOCTL(HCIDEVRESTAT)
COMPATIBLE_IOCTL(HCIGETDEVLIST)
COMPATIBLE_IOCTL(HCIGETDEVINFO)
COMPATIBLE_IOCTL(HCIGETCONNLIST)
COMPATIBLE_IOCTL(HCIGETCONNINFO)
COMPATIBLE_IOCTL(HCIGETAUTHINFO)
COMPATIBLE_IOCTL(HCISETRAW)
COMPATIBLE_IOCTL(HCISETSCAN)
COMPATIBLE_IOCTL(HCISETAUTH)
COMPATIBLE_IOCTL(HCISETENCRYPT)
COMPATIBLE_IOCTL(HCISETPTYPE)
COMPATIBLE_IOCTL(HCISETLINKPOL)
COMPATIBLE_IOCTL(HCISETLINKMODE)
COMPATIBLE_IOCTL(HCISETACLMTU)
COMPATIBLE_IOCTL(HCISETSCOMTU)
COMPATIBLE_IOCTL(HCIBLOCKADDR)
COMPATIBLE_IOCTL(HCIUNBLOCKADDR)
COMPATIBLE_IOCTL(HCIINQUIRY)
COMPATIBLE_IOCTL(HCIUARTSETPROTO) COMPATIBLE_IOCTL(HCIUARTSETPROTO)
COMPATIBLE_IOCTL(HCIUARTGETPROTO) COMPATIBLE_IOCTL(HCIUARTGETPROTO)
COMPATIBLE_IOCTL(HCIUARTGETDEVICE) COMPATIBLE_IOCTL(HCIUARTGETDEVICE)
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
*/ */
/* Bluetooth HCI sockets. */ /* Bluetooth HCI sockets. */
#include <linux/compat.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -1054,6 +1054,22 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1054,6 +1054,22 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd,
return err; return err;
} }
#ifdef CONFIG_COMPAT
static int hci_sock_compat_ioctl(struct socket *sock, unsigned int cmd,
unsigned long arg)
{
switch (cmd) {
case HCIDEVUP:
case HCIDEVDOWN:
case HCIDEVRESET:
case HCIDEVRESTAT:
return hci_sock_ioctl(sock, cmd, arg);
}
return hci_sock_ioctl(sock, cmd, (unsigned long)compat_ptr(arg));
}
#endif
static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
int addr_len) int addr_len)
{ {
...@@ -1974,6 +1990,9 @@ static const struct proto_ops hci_sock_ops = { ...@@ -1974,6 +1990,9 @@ static const struct proto_ops hci_sock_ops = {
.sendmsg = hci_sock_sendmsg, .sendmsg = hci_sock_sendmsg,
.recvmsg = hci_sock_recvmsg, .recvmsg = hci_sock_recvmsg,
.ioctl = hci_sock_ioctl, .ioctl = hci_sock_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = hci_sock_compat_ioctl,
#endif
.poll = datagram_poll, .poll = datagram_poll,
.listen = sock_no_listen, .listen = sock_no_listen,
.shutdown = sock_no_shutdown, .shutdown = sock_no_shutdown,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment