From owner-svn-src-all@freebsd.org Tue Jun 18 00:11:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6051615C8013; Tue, 18 Jun 2019 00:11:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 076B58840D; Tue, 18 Jun 2019 00:11:02 +0000 (UTC) (envelope-from ian@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6FA054F8; Tue, 18 Jun 2019 00:11:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5I0B1uC027661; Tue, 18 Jun 2019 00:11:01 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5I0B1hp027657; Tue, 18 Jun 2019 00:11:01 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201906180011.x5I0B1hp027657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 18 Jun 2019 00:11:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349164 - in head: sys/dev/pwm usr.sbin/pwm X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: sys/dev/pwm usr.sbin/pwm X-SVN-Commit-Revision: 349164 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 076B58840D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jun 2019 00:11:02 -0000 Author: ian Date: Tue Jun 18 00:11:00 2019 New Revision: 349164 URL: https://svnweb.freebsd.org/changeset/base/349164 Log: Remove everything related to channels from the pwmc public interface, now that there is a pwmc(4) instance per channel and the channel number is maintained as a driver ivar rather than being passed in from userland. Modified: head/sys/dev/pwm/pwmc.c head/sys/dev/pwm/pwmc.h head/usr.sbin/pwm/pwm.8 head/usr.sbin/pwm/pwm.c Modified: head/sys/dev/pwm/pwmc.c ============================================================================== --- head/sys/dev/pwm/pwmc.c Tue Jun 18 00:08:02 2019 (r349163) +++ head/sys/dev/pwm/pwmc.c Tue Jun 18 00:11:00 2019 (r349164) @@ -71,18 +71,12 @@ pwm_ioctl(struct cdev *dev, u_long cmd, caddr_t data, struct pwmc_softc *sc; struct pwm_state state; device_t bus; - u_int nchannel; int rv = 0; sc = dev->si_drv1; bus = device_get_parent(sc->dev); switch (cmd) { - case PWMMAXCHANNEL: - nchannel = 0; - rv = PWMBUS_CHANNEL_COUNT(bus, &nchannel); - bcopy(&nchannel, data, sizeof(nchannel)); - break; case PWMSETSTATE: bcopy(data, &state, sizeof(state)); rv = PWMBUS_CHANNEL_CONFIG(bus, sc->chan, Modified: head/sys/dev/pwm/pwmc.h ============================================================================== --- head/sys/dev/pwm/pwmc.h Tue Jun 18 00:08:02 2019 (r349163) +++ head/sys/dev/pwm/pwmc.h Tue Jun 18 00:11:00 2019 (r349164) @@ -34,7 +34,6 @@ #define PWM_POLARITY_INVERTED (1 << 0) struct pwm_state { - u_int channel; u_int period; u_int duty; uint32_t flags; @@ -45,9 +44,8 @@ struct pwm_state { * ioctls */ -#define PWMMAXCHANNEL _IOWR('G', 0, int) -#define PWMGETSTATE _IOWR('G', 1, struct pwm_state) -#define PWMSETSTATE _IOWR('G', 2, struct pwm_state) +#define PWMGETSTATE _IOWR('G', 0, struct pwm_state) +#define PWMSETSTATE _IOWR('G', 1, struct pwm_state) #endif /* _PWM_H_ */ Modified: head/usr.sbin/pwm/pwm.8 ============================================================================== --- head/usr.sbin/pwm/pwm.8 Tue Jun 18 00:08:02 2019 (r349163) +++ head/usr.sbin/pwm/pwm.8 Tue Jun 18 00:11:00 2019 (r349164) @@ -31,23 +31,18 @@ .Sh SYNOPSIS .Nm .Op Fl f Ar device -.Fl c Ar channel .Fl E .Nm .Op Fl f Ar device -.Fl c Ar channel .Fl D .Nm .Op Fl f Ar device -.Fl c Ar channel .Fl C .Nm .Op Fl f Ar device -.Fl c Ar channel .Fl p Ar period .Nm .Op Fl f Ar device -.Fl c Ar channel .Fl d Ar duty .Sh DESCRIPTION The @@ -55,9 +50,7 @@ The utility can be used to configure pwm controllers. .Pp The options are as follow: -.Bl -tag -width "-c channel" -.It Fl c Ar channel -Channel number to operate on. +.Bl -tag -width "-f device" .It Fl f Ar device Device to operate on. If not specified, Modified: head/usr.sbin/pwm/pwm.c ============================================================================== --- head/usr.sbin/pwm/pwm.c Tue Jun 18 00:08:02 2019 (r349163) +++ head/usr.sbin/pwm/pwm.c Tue Jun 18 00:11:00 2019 (r349164) @@ -66,11 +66,11 @@ static void usage(void) { fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\tpwm [-f dev] -c channel -E\n"); - fprintf(stderr, "\tpwm [-f dev] -c channel -D\n"); - fprintf(stderr, "\tpwm [-f dev] -c channel -C\n"); - fprintf(stderr, "\tpwm [-f dev] -c channel -p period\n"); - fprintf(stderr, "\tpwm [-f dev] -c channel -d duty\n"); + fprintf(stderr, "\tpwm [-f dev] -E\n"); + fprintf(stderr, "\tpwm [-f dev] -D\n"); + fprintf(stderr, "\tpwm [-f dev] -C\n"); + fprintf(stderr, "\tpwm [-f dev] -p period\n"); + fprintf(stderr, "\tpwm [-f dev] -d duty\n"); exit(1); } @@ -79,21 +79,19 @@ main(int argc, char *argv[]) { struct pwm_state state; int fd; - u_int channel, nchannels; int period, duty; int action, ch; cap_rights_t right_ioctl; - const unsigned long pwm_ioctls[] = {PWMGETSTATE, PWMSETSTATE, PWMMAXCHANNEL}; + const unsigned long pwm_ioctls[] = {PWMGETSTATE, PWMSETSTATE}; char *percent; bool setname; action = 0; setname = false; fd = -1; - channel = -1u; period = duty = -1; - while ((ch = getopt(argc, argv, "f:c:EDCp:d:")) != -1) { + while ((ch = getopt(argc, argv, "f:EDCp:d:")) != -1) { switch (ch) { case 'E': if (action) @@ -124,15 +122,13 @@ main(int argc, char *argv[]) if (*percent != '\0' && *percent != '%') usage(); break; - case 'c': - if (channel != -1u) - usage(); - channel = strtoul(optarg, NULL, 10); - break; case 'f': setname = true; set_device_name(optarg); break; + case '?': + usage(); + break; } } @@ -167,19 +163,7 @@ main(int argc, char *argv[]) goto fail; } - /* Check if the channel is correct */ - if (ioctl(fd, PWMMAXCHANNEL, &nchannels) == -1) { - fprintf(stderr, "ioctl: %s\n", strerror(errno)); - goto fail; - } - if (channel > nchannels) { - fprintf(stderr, "pwm controller only support %d channels\n", - nchannels); - goto fail; - } - /* Fill the common args */ - state.channel = channel; if (ioctl(fd, PWMGETSTATE, &state) == -1) { fprintf(stderr, "Cannot get current state of the pwm controller\n"); goto fail;