Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Use roundup. NFCI.
details: https://anonhg.NetBSD.org/src/rev/c32aa1576bfe
branches: trunk
changeset: 745881:c32aa1576bfe
user: skrll <skrll%NetBSD.org@localhost>
date: Sun Mar 15 07:56:19 2020 +0000
description:
Use roundup. NFCI.
diffstat:
sys/dev/usb/ehcivar.h | 10 +++++-----
sys/dev/usb/ohcivar.h | 8 ++++----
sys/dev/usb/uhcivar.h | 6 +++---
3 files changed, 12 insertions(+), 12 deletions(-)
diffs (106 lines):
diff -r 643cf5e64e42 -r c32aa1576bfe sys/dev/usb/ehcivar.h
--- a/sys/dev/usb/ehcivar.h Sun Mar 15 01:18:43 2020 +0000
+++ b/sys/dev/usb/ehcivar.h Sun Mar 15 07:56:19 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehcivar.h,v 1.47 2020/03/04 16:17:23 skrll Exp $ */
+/* $NetBSD: ehcivar.h,v 1.48 2020/03/15 07:56:19 skrll Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
uint16_t len;
} ehci_soft_qtd_t;
#define EHCI_SQTD_ALIGN MAX(EHCI_QTD_ALIGN, CACHE_LINE_SIZE)
-#define EHCI_SQTD_SIZE ((sizeof(struct ehci_soft_qtd) + EHCI_SQTD_ALIGN - 1) & -EHCI_SQTD_ALIGN)
+#define EHCI_SQTD_SIZE (roundup(sizeof(struct ehci_soft_qtd), EHCI_SQTD_ALIGN))
#define EHCI_SQTD_CHUNK (EHCI_PAGE_SIZE / EHCI_SQTD_SIZE)
typedef struct ehci_soft_qh {
@@ -56,7 +56,7 @@
int offs; /* QH's offset in usb_dma_t */
int islot;
} ehci_soft_qh_t;
-#define EHCI_SQH_SIZE ((sizeof(struct ehci_soft_qh) + EHCI_QH_ALIGN - 1) / EHCI_QH_ALIGN * EHCI_QH_ALIGN)
+#define EHCI_SQH_SIZE (roundup(sizeof(struct ehci_soft_qh), EHCI_QH_ALIGN))
#define EHCI_SQH_CHUNK (EHCI_PAGE_SIZE / EHCI_SQH_SIZE)
typedef struct ehci_soft_itd {
@@ -80,13 +80,13 @@
int slot;
struct timeval t; /* store free time */
} ehci_soft_itd_t;
-#define EHCI_ITD_SIZE ((sizeof(struct ehci_soft_itd) + EHCI_ITD_ALIGN - 1) / EHCI_ITD_ALIGN * EHCI_ITD_ALIGN)
+#define EHCI_ITD_SIZE (roundup(sizeof(struct ehci_soft_itd), EHCI_ITD_ALIGN))
#define EHCI_ITD_CHUNK (EHCI_PAGE_SIZE / EHCI_ITD_SIZE)
#define ehci_soft_sitd_t ehci_soft_itd_t
#define ehci_soft_sitd ehci_soft_itd
#define sc_softsitds sc_softitds
-#define EHCI_SITD_SIZE ((sizeof(struct ehci_soft_sitd) + EHCI_SITD_ALIGN - 1) / EHCI_SITD_ALIGN * EHCI_SITD_ALIGN)
+#define EHCI_SITD_SIZE (roundup(sizeof(struct ehci_soft_sitd), EHCI_SITD_ALIGN))
#define EHCI_SITD_CHUNK (EHCI_PAGE_SIZE / EHCI_SITD_SIZE)
struct ehci_xfer {
diff -r 643cf5e64e42 -r c32aa1576bfe sys/dev/usb/ohcivar.h
--- a/sys/dev/usb/ohcivar.h Sun Mar 15 01:18:43 2020 +0000
+++ b/sys/dev/usb/ohcivar.h Sun Mar 15 07:56:19 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohcivar.h,v 1.60 2018/08/09 06:26:47 mrg Exp $ */
+/* $NetBSD: ohcivar.h,v 1.61 2020/03/15 07:56:19 skrll Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
usb_dma_t dma;
int offs;
} ohci_soft_ed_t;
-#define OHCI_SED_SIZE ((sizeof(struct ohci_soft_ed) + OHCI_ED_ALIGN - 1) / OHCI_ED_ALIGN * OHCI_ED_ALIGN)
+#define OHCI_SED_SIZE (roundup(sizeof(struct ohci_soft_ed), OHCI_ED_ALIGN))
#define OHCI_SED_CHUNK 128
@@ -60,7 +60,7 @@
#define OHCI_CALL_DONE 0x0001
#define OHCI_ADD_LEN 0x0002
} ohci_soft_td_t;
-#define OHCI_STD_SIZE ((sizeof(struct ohci_soft_td) + OHCI_TD_ALIGN - 1) / OHCI_TD_ALIGN * OHCI_TD_ALIGN)
+#define OHCI_STD_SIZE (roundup(sizeof(struct ohci_soft_td), OHCI_TD_ALIGN))
#define OHCI_STD_CHUNK 128
@@ -76,7 +76,7 @@
uint16_t flags;
bool isdone; /* used only when DIAGNOSTIC is defined */
} ohci_soft_itd_t;
-#define OHCI_SITD_SIZE ((sizeof(struct ohci_soft_itd) + OHCI_ITD_ALIGN - 1) / OHCI_ITD_ALIGN * OHCI_ITD_ALIGN)
+#define OHCI_SITD_SIZE (roundup(sizeof(struct ohci_soft_itd), OHCI_ITD_ALIGN))
#define OHCI_SITD_CHUNK 64
diff -r 643cf5e64e42 -r c32aa1576bfe sys/dev/usb/uhcivar.h
--- a/sys/dev/usb/uhcivar.h Sun Mar 15 01:18:43 2020 +0000
+++ b/sys/dev/usb/uhcivar.h Sun Mar 15 07:56:19 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhcivar.h,v 1.56 2018/09/17 08:27:41 mrg Exp $ */
+/* $NetBSD: uhcivar.h,v 1.57 2020/03/15 07:56:19 skrll Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -112,7 +112,7 @@
* aligned.
* NOTE: Minimum size is 32 bytes.
*/
-#define UHCI_STD_SIZE ((sizeof(struct uhci_soft_td) + UHCI_TD_ALIGN - 1) / UHCI_TD_ALIGN * UHCI_TD_ALIGN)
+#define UHCI_STD_SIZE (roundup(sizeof(struct uhci_soft_td), UHCI_TD_ALIGN))
#define UHCI_STD_CHUNK 128 /*(PAGE_SIZE / UHCI_TD_SIZE)*/
/*
@@ -128,7 +128,7 @@
int offs; /* QH's offset in usb_dma_t */
};
/* See comment about UHCI_STD_SIZE. */
-#define UHCI_SQH_SIZE ((sizeof(struct uhci_soft_qh) + UHCI_QH_ALIGN - 1) / UHCI_QH_ALIGN * UHCI_QH_ALIGN)
+#define UHCI_SQH_SIZE (roundup(sizeof(struct uhci_soft_qh), UHCI_QH_ALIGN))
#define UHCI_SQH_CHUNK 128 /*(PAGE_SIZE / UHCI_QH_SIZE)*/
/*
Home |
Main Index |
Thread Index |
Old Index