Date: Thu, 31 Aug 2017 19:34:35 +0300 From: Alexander Motin <mav@FreeBSD.org> To: cem@freebsd.org Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r323053 - head/sys/dev/ntb/ntb_hw Message-ID: <0ec09a2c-9c86-2830-4af0-fca6d1aed3be@FreeBSD.org> In-Reply-To: <CAG6CVpUASypmZmg3F=4w-BkB04kSZF8ezCLDUF85Oh91%2BnoytQ@mail.gmail.com> References: <201708311341.v7VDfirg037860@repo.freebsd.org> <CAG6CVpUASypmZmg3F=4w-BkB04kSZF8ezCLDUF85Oh91%2BnoytQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 31.08.2017 17:43, Conrad Meyer wrote: >> Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c >> ============================================================================== >> --- head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Aug 31 13:32:01 2017 (r323052) >> +++ head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Aug 31 13:41:44 2017 (r323053) >> @@ -473,7 +473,7 @@ ntb_plx_link_enable(device_t dev, enum ntb_speed speed >> return (0); >> } >> >> - reg = (sc->port < 8) ? 0x00208 : 0x08208; >> + reg = ((sc->port & ~7) << 12) | 0x208; >> val = bus_read_4(sc->conf_res, reg); >> if ((val & (1 << (sc->port & 7))) == 0) { >> /* If already enabled, generate fake link event and exit. */ >> @@ -495,7 +495,7 @@ ntb_plx_link_disable(device_t dev) >> if (sc->link) >> return (0); >> >> - reg = (sc->port < 8) ? 0x00208 : 0x08208; >> + reg = ((sc->port & ~7) << 12) | 0x208; >> val = bus_read_4(sc->conf_res, reg); >> val |= (1 << (sc->port & 7)); >> bus_write_4(sc->conf_res, reg, val); >> @@ -512,7 +512,7 @@ ntb_plx_link_enabled(device_t dev) >> if (sc->link) >> return (TRUE); >> >> - reg = (sc->port < 8) ? 0x00208 : 0x08208; >> + reg = ((sc->port & ~7) << 12) | 0x208; >> val = bus_read_4(sc->conf_res, reg); >> return ((val & (1 << (sc->port & 7))) == 0); >> } >> > > To me, the duplication strongly suggests that this should be a macro. Added in r323058. -- Alexander Motin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0ec09a2c-9c86-2830-4af0-fca6d1aed3be>