From owner-svn-src-head@freebsd.org Thu Nov 3 07:40:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D4BFC2D057; Thu, 3 Nov 2016 07:40:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D94841D00; Thu, 3 Nov 2016 07:40:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA37erTA046403; Thu, 3 Nov 2016 07:40:53 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA37eqGq046397; Thu, 3 Nov 2016 07:40:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611030740.uA37eqGq046397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 3 Nov 2016 07:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308242 - in head: share/man/man4 sys/dev/smbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 07:40:54 -0000 Author: avg Date: Thu Nov 3 07:40:52 2016 New Revision: 308242 URL: https://svnweb.freebsd.org/changeset/base/308242 Log: smbus: remove smbus_trans / SMB_TRANS This change reverts most of r281985. The method did not map to anything defined by SMBus protocol and could not be implemented for SMBus controllers. This change is obviously not backwards compatible, but I have good reasons to believe that there have never been any users of SMB_TRANS. Discussed with: grembo, jhb MFC after: 6 weeks Modified: head/share/man/man4/smb.4 head/sys/dev/smbus/smb.c head/sys/dev/smbus/smb.h head/sys/dev/smbus/smbconf.h head/sys/dev/smbus/smbus_if.m Modified: head/share/man/man4/smb.4 ============================================================================== --- head/share/man/man4/smb.4 Thu Nov 3 00:58:50 2016 (r308241) +++ head/share/man/man4/smb.4 Thu Nov 3 07:40:52 2016 (r308242) @@ -162,33 +162,6 @@ to the device, then reads bytes of data that from the device. This data is returned in the buffer pointed to by .Fa rbuf . -.It Dv SMB_TRANS Ta -.Em Trans -sends an SMB roll-up transaction with flags that also allow it to -be used for (mostly) I2C pass-through and with 10-bit addresses. -This function can be utilized to roll up all of the above functions. -It first sends the byte from -.Fa cmd -to the device, followed by -.Fa wcount -bytes of data that are taken from the buffer pointed to by -.Fa wbuf , -then reads -.Fa rcount -bytes of data that from the device. -This data is returned in the buffer pointed to by -.Fa rbuf . -.Pp -The following flags are allowed in -.Fa op : -.Pp -.Bd -literal -compact -SMB_TRANS_NOSTOP Do not send STOP at end -SMB_TRANS_NOCMD Ignore cmd field (do not tx) -SMB_TRANS_NOCNT Do not tx or rx count field -SMB_TRANS_7BIT Change address mode to 7-bit -SMB_TRANS_10BIT Change address mode to 10-bit -.Ed .El .Pp The Modified: head/sys/dev/smbus/smb.c ============================================================================== --- head/sys/dev/smbus/smb.c Thu Nov 3 00:58:50 2016 (r308241) +++ head/sys/dev/smbus/smb.c Thu Nov 3 07:40:52 2016 (r308242) @@ -293,24 +293,6 @@ smbioctl(struct cdev *dev, u_long cmd, c error = copyout(buf, s->rbuf, s->rcount); break; - case SMB_TRANS: - if (s->rcount < 0 || s->wcount < 0) { - error = EINVAL; - break; - } - if (s->rcount > SMB_MAXBLOCKSIZE) - s->rcount = SMB_MAXBLOCKSIZE; - if (s->wcount > SMB_MAXBLOCKSIZE) - s->wcount = SMB_MAXBLOCKSIZE; - if (s->wcount) - error = copyin(s->wbuf, buf, s->wcount); - if (error) - break; - error = smbus_error(smbus_trans(parent, s->slave, s->cmd, - s->op, buf, s->wcount, buf, s->rcount, &s->rcount)); - if (error == 0) - error = copyout(buf, s->rbuf, s->rcount); - break; default: error = ENOTTY; } Modified: head/sys/dev/smbus/smb.h ============================================================================== --- head/sys/dev/smbus/smb.h Thu Nov 3 00:58:50 2016 (r308241) +++ head/sys/dev/smbus/smb.h Thu Nov 3 07:40:52 2016 (r308242) @@ -54,11 +54,8 @@ struct smbcmd { /* * SMBus spec 2.0 says block transfers may be at most 32 bytes. - * We use SMBus for i2c as well, make the size limit something more - * reasonable. Keep in mind that a char buf array is declared on the - * kernel stack. */ -#define SMB_MAXBLOCKSIZE 1024 +#define SMB_MAXBLOCKSIZE 32 #define SMB_QUICK_WRITE _IOW('i', 1, struct smbcmd) #define SMB_QUICK_READ _IOW('i', 2, struct smbcmd) @@ -72,6 +69,6 @@ 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) +#define SMB_OLD_TRANS _IOWR('i', 12, struct smbcmd) #endif Modified: head/sys/dev/smbus/smbconf.h ============================================================================== --- head/sys/dev/smbus/smbconf.h Thu Nov 3 00:58:50 2016 (r308241) +++ head/sys/dev/smbus/smbconf.h Thu Nov 3 07:40:52 2016 (r308242) @@ -72,25 +72,6 @@ #define SMB_QREAD 0x1 /* - * smbus transction op with pass-thru capabilities - * - * This smbus function is capable of doing a smbus command transaction - * (read or write), and can be flagged to not issue the 'cmd' and/or - * issue or expect a count field as well as flagged for chaining (no STOP), - * which gives it an i2c pass-through capability. - * - * NOSTOP- Caller chaining transactions, do not issue STOP - * NOCMD- Do not transmit the command field - * NOCNT- Do not transmit (wr) or expect (rd) the count field - */ -#define SMB_TRANS_NOSTOP 0x0001 /* do not send STOP at end */ -#define SMB_TRANS_NOCMD 0x0002 /* ignore cmd field (do not tx) */ -#define SMB_TRANS_NOCNT 0x0004 /* do not tx or rx count field */ -#define SMB_TRANS_7BIT 0x0008 /* change address mode to 7-bit */ -#define SMB_TRANS_10BIT 0x0010 /* change address mode to 10-bit */ -#define SMB_TRANS_NOREPORT 0x0020 /* do not report errors */ - -/* * ivars codes */ enum smbus_ivars { Modified: head/sys/dev/smbus/smbus_if.m ============================================================================== --- head/sys/dev/smbus/smbus_if.m Thu Nov 3 00:58:50 2016 (r308241) +++ head/sys/dev/smbus/smbus_if.m Thu Nov 3 07:40:52 2016 (r308242) @@ -149,20 +149,3 @@ METHOD int bread { u_char *count; char *buf; }; - -# -# SMB roll-up transaction with flags that also allow it to be -# used for (mostly) i2c pass-through and with 10-bit addresses. -# This function can be used to roll-up all of the above functions. -# -METHOD int trans { - device_t dev; - int slave; - char cmd; - int op; - char *wbuf; - int wcount; - char *rbuf; - int rcount; - int *actualp; -};