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: ciss.c,v 1.91 2022/04/16 19:19:59 naddy Exp $ */
/* $OpenBSD: ciss.c,v 1.92 2024/04/14 03:26:25 jsg Exp $ */
/*
* Copyright (c) 2005,2006 Michael Shalayeff
@ -217,7 +217,8 @@ ciss_attach(struct ciss_softc *sc)
sc->maxsg = MAXPHYS / PAGE_SIZE;
i = sizeof(struct ciss_ccb) +
sizeof(ccb->ccb_cmd.sgl[0]) * (sc->maxsg - 1);
for (sc->ccblen = 0x10; sc->ccblen < i; sc->ccblen <<= 1);
for (sc->ccblen = 0x10; sc->ccblen < i; sc->ccblen <<= 1)
;
total = sc->ccblen * sc->maxcmd;
if ((error = bus_dmamem_alloc(sc->dmat, total, PAGE_SIZE, 0,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: imxiic.c,v 1.1 2020/11/17 14:30:13 patrick Exp $ */
/* $OpenBSD: imxiic.c,v 1.2 2024/04/14 03:26:25 jsg Exp $ */
/*
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
*
@ -119,7 +119,8 @@ imxiic_setspeed(struct imxiic_softc *sc, u_int speed)
else if (div > sc->sc_clk_div[sc->sc_clk_ndiv - 1].div)
i = sc->sc_clk_ndiv - 1;
else
for (i = 0; sc->sc_clk_div[i].div < div; i++);
for (i = 0; sc->sc_clk_div[i].div < div; i++)
;
sc->frequency = sc->sc_clk_div[i].val;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rt2661.c,v 1.99 2022/04/21 21:03:02 stsp Exp $ */
/* $OpenBSD: rt2661.c,v 1.100 2024/04/14 03:26:25 jsg Exp $ */
/*-
* Copyright (c) 2006
@ -2274,7 +2274,8 @@ rt2661_set_chan(struct rt2661_softc *sc, struct ieee80211_channel *c)
rfprog = (sc->rfprog == 0) ? rt2661_rf5225_1 : rt2661_rf5225_2;
/* find the settings for this channel (we know it exists) */
for (i = 0; rfprog[i].chan != chan; i++);
for (i = 0; rfprog[i].chan != chan; i++)
;
power = sc->txpow[i];
if (power < 0) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rt2860.c,v 1.102 2022/04/21 21:03:02 stsp Exp $ */
/* $OpenBSD: rt2860.c,v 1.103 2024/04/14 03:26:25 jsg Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
@ -2225,7 +2225,8 @@ rt2860_set_chan(struct rt2860_softc *sc, u_int chan)
u_int i;
/* find the settings for this channel (we know it exists) */
for (i = 0; rfprog[i].chan != chan; i++);
for (i = 0; rfprog[i].chan != chan; i++)
;
r2 = rfprog[i].r2;
if (sc->ntxchains == 1)
@ -2281,7 +2282,8 @@ rt3090_set_chan(struct rt2860_softc *sc, u_int chan)
KASSERT(chan >= 1 && chan <= 14); /* RT3090 is 2GHz only */
/* find the settings for this channel (we know it exists) */
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
;
/* use Tx power values from EEPROM */
txpow1 = sc->txpow1[i];
@ -2346,7 +2348,8 @@ rt5390_set_chan(struct rt2860_softc *sc, u_int chan)
KASSERT(chan >= 1 && chan <= 14);
/* find the settings for this channel (we know it exists) */
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
;
/* use Tx power values from EEPROM */
txpow1 = sc->txpow1[i];
@ -4054,10 +4057,12 @@ rt2860_calib(struct rt2860_softc *sc)
if (bbp49 < tssi[0]) { /* lower than reference */
/* use higher Tx power than default */
for (d = 0; d > -4 && bbp49 <= tssi[d - 1]; d--);
for (d = 0; d > -4 && bbp49 <= tssi[d - 1]; d--)
;
} else if (bbp49 > tssi[0]) { /* greater than reference */
/* use lower Tx power than default */
for (d = 0; d < +4 && bbp49 >= tssi[d + 1]; d++);
for (d = 0; d < +4 && bbp49 >= tssi[d + 1]; d++)
;
} else {
/* use default Tx power */
d = 0;

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;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bpp.c,v 1.6 2019/12/31 10:05:33 mpi Exp $ */
/* $OpenBSD: bpp.c,v 1.7 2024/04/14 03:23:13 jsg Exp $ */
/* $NetBSD: bpp.c,v 1.25 2005/12/11 12:23:44 christos Exp $ */
/*-
@ -318,7 +318,8 @@ bppwrite(dev_t dev, struct uio *uio, int flags)
if (bppdebug) {
size_t i;
printf("bpp: writing %ld : ", len);
for (i=0; i<len; i++) printf("%c(0x%x)", bp[i], bp[i]);
for (i=0; i<len; i++)
printf("%c(0x%x)", bp[i], bp[i]);
printf("\n");
}
#endif

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_mtw.c,v 1.9 2024/04/12 09:56:39 jsg Exp $ */
/* $OpenBSD: if_mtw.c,v 1.10 2024/04/14 03:26:25 jsg Exp $ */
/*
* Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr>
* Copyright (c) 2013-2014 Kevin Lo
@ -2549,7 +2549,8 @@ mt7601_set_chan(struct mtw_softc *sc, u_int chan)
int i;
/* find the settings for this channel */
for (i = 0; mt7601_rf_chan[i].chan != chan; i++);
for (i = 0; mt7601_rf_chan[i].chan != chan; i++)
;
mtw_rf_write(sc, 0, 17, mt7601_rf_chan[i].r17);
mtw_rf_write(sc, 0, 18, mt7601_rf_chan[i].r18);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_rum.c,v 1.127 2022/04/21 21:03:03 stsp Exp $ */
/* $OpenBSD: if_rum.c,v 1.128 2024/04/14 03:26:25 jsg Exp $ */
/*-
* Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr>
@ -1654,7 +1654,8 @@ rum_set_chan(struct rum_softc *sc, struct ieee80211_channel *c)
sc->rf_rev == RT2573_RF_2527) ? rum_rf5225 : rum_rf5226;
/* find the settings for this channel (we know it exists) */
for (i = 0; rfprog[i].chan != chan; i++);
for (i = 0; rfprog[i].chan != chan; i++)
;
power = sc->txpow[i];
if (power < 0) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_run.c,v 1.138 2023/03/08 04:43:08 guenther Exp $ */
/* $OpenBSD: if_run.c,v 1.139 2024/04/14 03:26:25 jsg Exp $ */
/*-
* Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr>
@ -2906,7 +2906,8 @@ run_rt2870_set_chan(struct run_softc *sc, u_int chan)
int i;
/* find the settings for this channel (we know it exists) */
for (i = 0; rfprog[i].chan != chan; i++);
for (i = 0; rfprog[i].chan != chan; i++)
;
r2 = rfprog[i].r2;
if (sc->ntxchains == 1)
@ -2960,7 +2961,8 @@ run_rt3070_set_chan(struct run_softc *sc, u_int chan)
int i;
/* find the settings for this channel (we know it exists) */
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
;
/* use Tx power values from EEPROM */
txpow1 = sc->txpow1[i];
@ -3026,7 +3028,8 @@ run_rt3572_set_chan(struct run_softc *sc, u_int chan)
int i;
/* find the settings for this channel (we know it exists) */
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
;
/* use Tx power values from EEPROM */
txpow1 = sc->txpow1[i];
@ -3175,7 +3178,8 @@ run_rt3593_set_chan(struct run_softc *sc, u_int chan)
int i;
/* find the settings for this channel (we know it exists) */
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
;
/* use Tx power values from EEPROM */
txpow1 = sc->txpow1[i];
@ -3335,7 +3339,8 @@ run_rt5390_set_chan(struct run_softc *sc, u_int chan)
int i;
/* find the settings for this channel (we know it exists) */
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
;
/* use Tx power values from EEPROM */
txpow1 = sc->txpow1[i];
@ -3451,7 +3456,8 @@ run_rt5592_set_chan(struct run_softc *sc, u_int chan)
rt5592_freqs_40mhz : rt5592_freqs_20mhz;
/* find the settings for this channel (we know it exists) */
for (i = 0; rt2860_rf2850[i].chan != chan; i++, freqs++);
for (i = 0; rt2860_rf2850[i].chan != chan; i++, freqs++)
;
/* use Tx power values from EEPROM */
txpow1 = sc->txpow1[i];