Module Name: src Committed By: skrll Date: Sun Mar 15 07:56:19 UTC 2020
Modified Files: src/sys/dev/usb: ehcivar.h ohcivar.h uhcivar.h Log Message: Use roundup. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/dev/usb/ehcivar.h cvs rdiff -u -r1.60 -r1.61 src/sys/dev/usb/ohcivar.h cvs rdiff -u -r1.56 -r1.57 src/sys/dev/usb/uhcivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/usb/ehcivar.h diff -u src/sys/dev/usb/ehcivar.h:1.47 src/sys/dev/usb/ehcivar.h:1.48 --- src/sys/dev/usb/ehcivar.h:1.47 Wed Mar 4 16:17:23 2020 +++ src/sys/dev/usb/ehcivar.h Sun Mar 15 07:56:19 2020 @@ -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 @@ typedef struct ehci_soft_qtd { 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 @@ typedef struct ehci_soft_qh { 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 @@ typedef struct ehci_soft_itd { 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 { Index: src/sys/dev/usb/ohcivar.h diff -u src/sys/dev/usb/ohcivar.h:1.60 src/sys/dev/usb/ohcivar.h:1.61 --- src/sys/dev/usb/ohcivar.h:1.60 Thu Aug 9 06:26:47 2018 +++ src/sys/dev/usb/ohcivar.h Sun Mar 15 07:56:19 2020 @@ -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 @@ typedef struct ohci_soft_ed { 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 @@ typedef struct ohci_soft_td { #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 @@ typedef struct ohci_soft_itd { 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 Index: src/sys/dev/usb/uhcivar.h diff -u src/sys/dev/usb/uhcivar.h:1.56 src/sys/dev/usb/uhcivar.h:1.57 --- src/sys/dev/usb/uhcivar.h:1.56 Mon Sep 17 08:27:41 2018 +++ src/sys/dev/usb/uhcivar.h Sun Mar 15 07:56:19 2020 @@ -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 @@ struct uhci_soft_td { * 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 @@ struct uhci_soft_qh { 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)*/ /*