svn commit: r348355 - head/sys/dev/iicbus
Andriy Gapon
avg at FreeBSD.org
Mon Jun 3 12:14:20 UTC 2019
On 03/06/2019 14:16, Niclas Zeising wrote:
> Hi!
> It seems like things broke after all, latest pkg build (on head-amd64) reports
> this:
>
>
> /wrkdirs/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-12bd551/src/dev/drm2/i915/intel_iic.c:570:2:
> error: implicit declaration of function 'iicbus_set_nostop' is invalid in C99
> [-Werror,-Wimplicit-function-declaration]
> iicbus_set_nostop(idev, true);
> ^
> /wrkdirs/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-12bd551/src/dev/drm2/i915/intel_iic.c:570:2:
> error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
> 2 errors generated.
>
> Full log:
>
> http://beefy12.nyi.freebsd.org/data/head-amd64-default/p503023_s348376/logs/drm-legacy-kmod-g20190523.log
Hi! Thank you for the report.
I am going to restore iicbus_set_nostop, but this time as a function that
modifies iicbus softc (instead of an ivar accessor for the bus).
I am including a patch that I would like to commit.
However, for the drm code to request the nostop mode correctly it needs to be
fixed as well.
My proposed patch is here: https://github.com/FreeBSDDesktop/drm-legacy/pull/9
Index: sys/dev/iicbus/iicbus.h
===================================================================
--- sys/dev/iicbus/iicbus.h (revision 348529)
+++ sys/dev/iicbus/iicbus.h (working copy)
@@ -46,6 +46,8 @@ struct iicbus_softc
* 0 if no start condition succeeded */
u_char strict; /* deny operations that violate the
* I2C protocol */
+ bool nostop; /* iicbus_transfer defaults to repeated
+ * start between messages */
struct mtx lock;
u_int bus_freq; /* Configured bus Hz. */
};
@@ -77,6 +79,7 @@ IICBUS_ACCESSOR(addr, ADDR, uint32_t)
int iicbus_generic_intr(device_t dev, int event, char *buf);
void iicbus_init_frequency(device_t dev, u_int bus_freq);
+void iicbus_set_nostop(device_t dev, bool val);
extern driver_t iicbus_driver;
extern devclass_t iicbus_devclass;
Index: sys/dev/iicbus/iiconf.c
===================================================================
--- sys/dev/iicbus/iiconf.c (revision 348529)
+++ sys/dev/iicbus/iiconf.c (working copy)
@@ -383,6 +383,14 @@ iicbus_block_read(device_t bus, u_char slave, char
return (error);
}
+void
+iicbus_set_nostop(device_t bus, bool val)
+{
+ struct iicbus_softc *sc = device_get_softc(bus);
+
+ sc->nostop = val;
+}
+
/*
* iicbus_transfer()
*
@@ -427,7 +435,8 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *
{
int i, error, lenread, lenwrote, nkid, rpstart, addr;
device_t *children, bus;
- bool started;
+ struct iicbus_softc *sc;
+ bool nostop, started;
if ((error = device_get_children(dev, &children, &nkid)) != 0)
return (IIC_ERESOURCE);
@@ -438,6 +447,8 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *
bus = children[0];
rpstart = 0;
free(children, M_TEMP);
+ sc = device_get_softc(bus);
+ nostop = sc->nostop;
started = false;
for (i = 0, error = 0; i < nmsgs && error == 0; i++) {
addr = msgs[i].slave;
@@ -465,11 +476,12 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *
if (error != 0)
break;
- if (!(msgs[i].flags & IIC_M_NOSTOP)) {
+ if ((msgs[i].flags & IIC_M_NOSTOP) != 0 ||
+ (nostop && i + 1 < nmsgs)) {
+ rpstart = 1; /* Next message gets repeated start */
+ } else {
rpstart = 0;
iicbus_stop(bus);
- } else {
- rpstart = 1; /* Next message gets repeated start */
}
}
if (error != 0 && started)
--
Andriy Gapon
More information about the svn-src-head
mailing list