diff options
author | avg <avg@FreeBSD.org> | 2016-12-14 16:05:48 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2016-12-14 16:05:48 +0000 |
commit | 6f666bb658a579f55dcf9380f0a5344170482026 (patch) | |
tree | a5e45b7b2971de72e74871dd15e67a2b2c9f1c36 | |
parent | a89dc232eb90e693a17c4950f07781cc8eed0411 (diff) | |
download | FreeBSD-src-6f666bb658a579f55dcf9380f0a5344170482026.zip FreeBSD-src-6f666bb658a579f55dcf9380f0a5344170482026.tar.gz |
MFC r308527: smb: fix SMB_READB, SMB_READW, SMB_PCALL to work as documented
-rw-r--r-- | sys/dev/smbus/smb.c | 10 | ||||
-rw-r--r-- | sys/dev/smbus/smb.h | 7 |
2 files changed, 12 insertions, 5 deletions
diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c index e842441..6d9aa8a 100644 --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -41,7 +41,9 @@ #include "smbus_if.h" -#define BUFSIZE 1024 +#define SMB_OLD_READB _IOW('i', 7, struct smbcmd) +#define SMB_OLD_READW _IOW('i', 8, struct smbcmd) +#define SMB_OLD_PCALL _IOW('i', 9, struct smbcmd) struct smb_softc { device_t sc_dev; @@ -224,7 +226,9 @@ smbioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t s->cmd, s->wdata.word)); break; + case SMB_OLD_READB: case SMB_READB: + /* NB: for SMB_OLD_READB the read data goes to rbuf only. */ error = smbus_error(smbus_readb(parent, s->slave, s->cmd, &s->rdata.byte)); if (error) @@ -235,7 +239,9 @@ smbioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t } break; + case SMB_OLD_READW: case SMB_READW: + /* NB: for SMB_OLD_READW the read data goes to rbuf only. */ error = smbus_error(smbus_readw(parent, s->slave, s->cmd, &s->rdata.word)); if (error) @@ -248,7 +254,9 @@ smbioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t } break; + case SMB_OLD_PCALL: case SMB_PCALL: + /* NB: for SMB_OLD_PCALL the read data goes to rbuf only. */ error = smbus_error(smbus_pcall(parent, s->slave, s->cmd, s->wdata.word, &s->rdata.word)); if (error) diff --git a/sys/dev/smbus/smb.h b/sys/dev/smbus/smb.h index 8007653..fec2d67 100644 --- a/sys/dev/smbus/smb.h +++ b/sys/dev/smbus/smb.h @@ -66,11 +66,10 @@ struct smbcmd { #define SMB_RECVB _IOWR('i', 4, struct smbcmd) #define SMB_WRITEB _IOW('i', 5, struct smbcmd) #define SMB_WRITEW _IOW('i', 6, struct smbcmd) -#define SMB_READB _IOW('i', 7, struct smbcmd) -#define SMB_READW _IOW('i', 8, struct smbcmd) -#define SMB_PCALL _IOW('i', 9, struct smbcmd) +#define SMB_READB _IOWR('i', 7, struct smbcmd) +#define SMB_READW _IOWR('i', 8, struct smbcmd) +#define SMB_PCALL _IOWR('i', 9, struct smbcmd) #define SMB_BWRITE _IOW('i', 10, struct smbcmd) -#define SMB_OLD_BREAD _IOW('i', 11, struct smbcmd) #define SMB_BREAD _IOWR('i', 11, struct smbcmd) #define SMB_TRANS _IOWR('i', 12, struct smbcmd) |