From ccdb918fc092d1cad3a7e59523a26b0d84dcc52c Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 10 Apr 2015 12:06:52 +0000 Subject: [PATCH] Move irqs_disabled() and in_dbg_master() out of the i386/amd64 ifdef block and change drm_can_sleep() to only use in_atomic() on i386/amd64 as it isn't defined for other archs currently. Unbreaks the sparc64 build. Found the hard way by benoit@ --- sys/dev/pci/drm/drmP.h | 6 +++++- sys/dev/pci/drm/drm_linux.h | 32 ++++++++++++++++---------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 36dc0220553..129b3c01fb8 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drmP.h,v 1.189 2015/04/10 06:00:39 jsg Exp $ */ +/* $OpenBSD: drmP.h,v 1.190 2015/04/10 12:06:52 jsg Exp $ */ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com */ @@ -159,7 +159,11 @@ extern struct cfdriver drm_cd; static inline bool drm_can_sleep(void) { +#if defined(__i386__) || defined(__amd64__) if (in_atomic() || in_dbg_master() || irqs_disabled()) +#else + if (in_dbg_master() || irqs_disabled()) +#endif return false; return true; } diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h index e6d71f7fa27..8fac1c8ef4f 100644 --- a/sys/dev/pci/drm/drm_linux.h +++ b/sys/dev/pci/drm/drm_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.h,v 1.16 2015/04/10 05:31:25 jsg Exp $ */ +/* $OpenBSD: drm_linux.h,v 1.17 2015/04/10 12:06:52 jsg Exp $ */ /* * Copyright (c) 2013, 2014 Mark Kettenis * @@ -513,6 +513,21 @@ static inline uint32_t ror32(uint32_t word, unsigned int shift) return (word >> shift) | (word << (32 - shift)); } +static inline int +irqs_disabled(void) +{ + return (cold); +} + +static inline int +in_dbg_master(void) +{ +#ifdef DDB + return (db_is_active); +#endif + return (0); +} + #ifdef __macppc__ static __inline int of_machine_is_compatible(const char *model) @@ -544,21 +559,6 @@ in_atomic(void) return curcpu()->ci_inatomic; } -static inline int -irqs_disabled(void) -{ - return (cold); -} - -static inline int -in_dbg_master(void) -{ -#ifdef DDB - return (db_is_active); -#endif - return (0); -} - static inline void * kmap_atomic(struct vm_page *pg) { -- 2.20.1