svn commit: r358721 - head/sys/dev/iicbus
Andreas Tobler
andreast at FreeBSD.org
Fri Mar 6 21:24:10 UTC 2020
Author: andreast
Date: Fri Mar 6 21:24:09 2020
New Revision: 358721
URL: https://svnweb.freebsd.org/changeset/base/358721
Log:
Drop 'All rights reserved'
Replace hardcoded sizes by nitems and sizeof
Modified:
head/sys/dev/iicbus/ds1631.c
Modified: head/sys/dev/iicbus/ds1631.c
==============================================================================
--- head/sys/dev/iicbus/ds1631.c Fri Mar 6 21:21:01 2020 (r358720)
+++ head/sys/dev/iicbus/ds1631.c Fri Mar 6 21:24:09 2020 (r358721)
@@ -2,7 +2,6 @@
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2012 Andreas Tobler
- * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -135,7 +134,7 @@ ds1631_write(device_t dev, uint32_t addr, uint8_t reg,
for (;;)
{
- if (iicbus_transfer(dev, msg, 1) == 0)
+ if (iicbus_transfer(dev, msg, nitems(msg)) == 0)
return (0);
if (++try > 5) {
device_printf(dev, "iicbus write failed\n");
@@ -158,7 +157,7 @@ ds1631_read_1(device_t dev, uint32_t addr, uint8_t reg
for (;;)
{
- err = iicbus_transfer(dev, msg, 2);
+ err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0)
goto retry;
@@ -186,7 +185,7 @@ ds1631_read_2(device_t dev, uint32_t addr, uint8_t reg
for (;;)
{
- err = iicbus_transfer(dev, msg, 2);
+ err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0)
goto retry;
@@ -275,7 +274,7 @@ ds1631_init(device_t dev, uint32_t addr)
*/
conf = DS1631_CONTROL_10BIT;
- err = ds1631_write(dev, addr, DS1631_CONTROL, &conf, 1);
+ err = ds1631_write(dev, addr, DS1631_CONTROL, &conf, sizeof(conf));
if (err < 0) {
device_printf(dev, "ds1631 write config failed: %x\n", err);
return (-1);
More information about the svn-src-head
mailing list