Drop 'All rights reserved'

Replace hardcoded sizes by nitems and sizeof
This commit is contained in:
Andreas Tobler 2020-03-06 21:24:09 +00:00
parent 7cc4d41e40
commit e65d6406fd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358721

View File

@ -2,7 +2,6 @@
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* *
* Copyright (c) 2012 Andreas Tobler * Copyright (c) 2012 Andreas Tobler
* All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -135,7 +134,7 @@ ds1631_write(device_t dev, uint32_t addr, uint8_t reg, uint8_t *buff, int len)
for (;;) for (;;)
{ {
if (iicbus_transfer(dev, msg, 1) == 0) if (iicbus_transfer(dev, msg, nitems(msg)) == 0)
return (0); return (0);
if (++try > 5) { if (++try > 5) {
device_printf(dev, "iicbus write failed\n"); device_printf(dev, "iicbus write failed\n");
@ -158,7 +157,7 @@ ds1631_read_1(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data)
for (;;) for (;;)
{ {
err = iicbus_transfer(dev, msg, 2); err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0) if (err != 0)
goto retry; goto retry;
@ -186,7 +185,7 @@ ds1631_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data)
for (;;) for (;;)
{ {
err = iicbus_transfer(dev, msg, 2); err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0) if (err != 0)
goto retry; goto retry;
@ -275,7 +274,7 @@ ds1631_init(device_t dev, uint32_t addr)
*/ */
conf = DS1631_CONTROL_10BIT; 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) { if (err < 0) {
device_printf(dev, "ds1631 write config failed: %x\n", err); device_printf(dev, "ds1631 write config failed: %x\n", err);
return (-1); return (-1);