sync with OpenBSD -current

This commit is contained in:
purplerain 2024-04-15 03:08:26 +00:00
parent e0d126d03b
commit 9d8ac7f158
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
49 changed files with 304 additions and 657 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: auglx.c,v 1.23 2022/10/26 20:19:08 kn Exp $ */
/* $OpenBSD: auglx.c,v 1.24 2024/04/14 03:26:25 jsg Exp $ */
/*
* Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org>
@ -669,7 +669,8 @@ auglx_trigger_output(void *v, void *start, void *end, int blksize,
DPRINTF(AUGLX_DBG_DMA, ("%s: trigger_output, %p 0x%08x bytes, "
"blksize 0x%04x\n", sc->sc_dev.dv_xname, start, size, blksize));
for (p = sc->sc_dmas; p && p->addr != start; p = p->next);
for (p = sc->sc_dmas; p && p->addr != start; p = p->next)
;
if (!p) {
DPRINTF(AUGLX_DBG_DMA, ("%s dma reg not found\n",
sc->sc_dev.dv_xname));
@ -730,7 +731,8 @@ auglx_trigger_input(void *v, void *start, void *end, int blksize,
DPRINTF(AUGLX_DBG_DMA, ("%s: trigger_input, %p 0x%08x bytes, "
"blksize 0x%04x\n", sc->sc_dev.dv_xname, start, size, blksize));
for (p = sc->sc_dmas; p && p->addr != start; p = p->next);
for (p = sc->sc_dmas; p && p->addr != start; p = p->next)
;
if (!p) {
DPRINTF(AUGLX_DBG_DMA, ("%s dma reg not found\n",
sc->sc_dev.dv_xname));

View file

@ -778,8 +778,8 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp,
* nodes, but not more than args->num_of_nodes as that is
* the amount of memory allocated by user
*/
pa = kzalloc((sizeof(struct kfd_process_device_apertures) *
args->num_of_nodes), GFP_KERNEL);
pa = kcalloc(args->num_of_nodes, sizeof(struct kfd_process_device_apertures),
GFP_KERNEL);
if (!pa)
return -ENOMEM;

View file

@ -57,10 +57,10 @@ void mod_stats_update_event(struct mod_stats *mod_stats,
unsigned int length);
void mod_stats_update_flip(struct mod_stats *mod_stats,
unsigned long timestamp_in_ns);
unsigned long long timestamp_in_ns);
void mod_stats_update_vupdate(struct mod_stats *mod_stats,
unsigned long timestamp_in_ns);
unsigned long long timestamp_in_ns);
void mod_stats_update_freesync(struct mod_stats *mod_stats,
unsigned int v_total_min,

View file

@ -193,13 +193,22 @@ int drm_mode_config_helper_suspend(struct drm_device *dev)
if (!dev)
return 0;
/*
* Don't disable polling if it was never initialized
*/
if (dev->mode_config.poll_enabled)
drm_kms_helper_poll_disable(dev);
drm_kms_helper_poll_disable(dev);
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1);
state = drm_atomic_helper_suspend(dev);
if (IS_ERR(state)) {
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
drm_kms_helper_poll_enable(dev);
/*
* Don't enable polling if it was never initialized
*/
if (dev->mode_config.poll_enabled)
drm_kms_helper_poll_enable(dev);
return PTR_ERR(state);
}
@ -239,7 +248,11 @@ int drm_mode_config_helper_resume(struct drm_device *dev)
dev->mode_config.suspend_state = NULL;
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
drm_kms_helper_poll_enable(dev);
/*
* Don't enable polling if it is not initialized
*/
if (dev->mode_config.poll_enabled)
drm_kms_helper_poll_enable(dev);
return ret;
}

View file

@ -293,14 +293,17 @@ static void reschedule_output_poll_work(struct drm_device *dev)
* Drivers can call this helper from their device resume implementation. It is
* not an error to call this even when output polling isn't enabled.
*
* If device polling was never initialized before, this call will trigger a
* warning and return.
*
* Note that calls to enable and disable polling must be strictly ordered, which
* is automatically the case when they're only call from suspend/resume
* callbacks.
*/
void drm_kms_helper_poll_enable(struct drm_device *dev)
{
if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll ||
dev->mode_config.poll_running)
if (drm_WARN_ON_ONCE(dev, !dev->mode_config.poll_enabled) ||
!drm_kms_helper_poll || dev->mode_config.poll_running)
return;
if (drm_kms_helper_enable_hpd(dev) ||
@ -626,8 +629,12 @@ retry:
0);
}
/* Re-enable polling in case the global poll config changed. */
drm_kms_helper_poll_enable(dev);
/*
* Re-enable polling in case the global poll config changed but polling
* is still initialized.
*/
if (dev->mode_config.poll_enabled)
drm_kms_helper_poll_enable(dev);
if (connector->status == connector_status_disconnected) {
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
@ -881,12 +888,18 @@ EXPORT_SYMBOL(drm_kms_helper_is_poll_worker);
* not an error to call this even when output polling isn't enabled or already
* disabled. Polling is re-enabled by calling drm_kms_helper_poll_enable().
*
* If however, the polling was never initialized, this call will trigger a
* warning and return
*
* Note that calls to enable and disable polling must be strictly ordered, which
* is automatically the case when they're only call from suspend/resume
* callbacks.
*/
void drm_kms_helper_poll_disable(struct drm_device *dev)
{
if (drm_WARN_ON(dev, !dev->mode_config.poll_enabled))
return;
if (dev->mode_config.poll_running)
drm_kms_helper_disable_hpd(dev);

View file

@ -764,7 +764,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
* This function may sleep while waiting for space to become available.
* Returns:
* -EBUSY: No space available (only if no_wait == 1).
* -ENOMEM: Could not allocate memory for the buffer object, either due to
* -ENOSPC: Could not allocate space for the buffer object, either due to
* fragmentation or concurrent allocators.
* -ERESTARTSYS: An interruptible sleep was interrupted by a signal.
*/
@ -824,7 +824,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
goto error;
}
ret = -ENOMEM;
ret = -ENOSPC;
if (!type_found) {
pr_err(TTM_PFX "No compatible memory type found\n");
ret = -EINVAL;
@ -910,6 +910,9 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
return -EINVAL;
ret = ttm_bo_move_buffer(bo, placement, ctx);
/* For backward compatibility with userspace */
if (ret == -ENOSPC)
return -ENOMEM;
if (ret)
return ret;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_bge.c,v 1.403 2024/02/11 06:40:46 jmc Exp $ */
/* $OpenBSD: if_bge.c,v 1.404 2024/04/14 03:26:25 jsg Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@ -4079,7 +4079,8 @@ bge_cksum_pad(struct mbuf *m)
* Walk packet chain to find last mbuf. We will either
* pad there, or append a new mbuf and pad it.
*/
for (last = m; last->m_next != NULL; last = last->m_next);
for (last = m; last->m_next != NULL; last = last->m_next)
;
if (m_trailingspace(last) < padlen) {
/* Allocate new empty mbuf, pad it. Compact later. */
struct mbuf *n;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_ipw.c,v 1.133 2023/03/08 04:43:08 guenther Exp $ */
/* $OpenBSD: if_ipw.c,v 1.134 2024/04/14 03:26:25 jsg Exp $ */
/*-
* Copyright (c) 2004-2008
@ -653,7 +653,8 @@ ipw_media_status(struct ifnet *ifp, struct ifmediareq *imr)
val &= 0xf;
/* convert rate to 802.11 rate */
for (i = 0; i < nitems(rates) && rates[i].val != val; i++);
for (i = 0; i < nitems(rates) && rates[i].val != val; i++)
;
rate = (i < nitems(rates)) ? rates[i].rate : 0;
imr->ifm_active |= IFM_IEEE80211_11B;