* Re: [PATCH] staging: rtl8723bs: rename ndis_802_11_network_infrastructure enum values to uppercase
From: Nguyễn Công @ 2026-06-01 16:14 UTC (permalink / raw)
To: Greg KH; +Cc: linux-staging, linux-kernel
In-Reply-To: <2026052117-snore-bladder-110d@gregkh>
You're right, the kernel already provides the enum nl80211_iftype.
I've reworked the patch to use it directly and drop the translation
layer.
v2: https://lore.kernel.org/linux-staging/20260601161051.1832080-1-congnt264@gmail.com/
On Thu, May 21, 2026 at 4:10 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Mon, May 11, 2026 at 08:49:30PM +0700, Cong Nguyen wrote:
> > --- a/drivers/staging/rtl8723bs/include/wlan_bssdef.h
> > +++ b/drivers/staging/rtl8723bs/include/wlan_bssdef.h
> > @@ -43,11 +43,11 @@ struct ndis_802_11_conf {
> > };
> >
> > enum ndis_802_11_network_infrastructure {
> > - Ndis802_11IBSS,
> > - Ndis802_11Infrastructure,
> > - Ndis802_11AutoUnknown,
> > - Ndis802_11InfrastructureMax, /* Not a real value, defined as upper bound */
> > - Ndis802_11APMode,
> > + NDIS_802_11_IBSS,
> > + NDIS_802_11_INFRASTRUCTURE,
> > + NDIS_802_11_AUTO_UNKNOWN,
> > + NDIS_802_11_INFRASTRUCTURE_MAX, /* Not a real value, defined as upper bound */
> > + NDIS_802_11_AP_MODE,
> > };
>
> Why aren't you just using the NDIS values that the kernel already
> provides for these? Don't re-invent the wheel.
>
> thanks,
>
> greg k-h
^ permalink raw reply
* [PATCH v2] staging: rtl8723bs: use nl80211_iftype instead of custom NDIS enum
From: Cong Nguyen @ 2026-06-01 16:10 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, Cong Nguyen
The driver defined its own enum ndis_802_11_network_infrastructure to
represent the operating mode (STA/AP/IBSS) and translated nl80211 iftypes
into it in cfg80211_rtw_change_iface(). The kernel already provides
enum nl80211_iftype for this purpose, so use it directly and drop the
redundant translation layer.
Map the removed values as follows:
Ndis802_11IBSS -> NL80211_IFTYPE_ADHOC
Ndis802_11Infrastructure -> NL80211_IFTYPE_STATION
Ndis802_11APMode -> NL80211_IFTYPE_AP
Ndis802_11AutoUnknown -> NL80211_IFTYPE_UNSPECIFIED
Compile-tested only.
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
Changes in v2:
- Replace the custom enum ndis_802_11_network_infrastructure with the
standard enum nl80211_iftype and drop the translation layer, instead
of just renaming the enum values to uppercase (Greg Kroah-Hartman).
v1: https://lore.kernel.org/linux-staging/20260511134930.4086521-1-congnt264@gmail.com/
drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_cmd.c | 12 ++++------
.../staging/rtl8723bs/core/rtw_ioctl_set.c | 21 ++++++++---------
drivers/staging/rtl8723bs/core/rtw_mlme.c | 8 +++----
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 14 +++++------
drivers/staging/rtl8723bs/hal/hal_intf.c | 8 +++----
drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 6 ++---
drivers/staging/rtl8723bs/include/rtw_cmd.h | 2 +-
.../staging/rtl8723bs/include/rtw_ioctl_set.h | 2 +-
.../staging/rtl8723bs/include/wlan_bssdef.h | 14 +----------
.../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 23 ++++++-------------
drivers/staging/rtl8723bs/os_dep/os_intfs.c | 2 +-
12 files changed, 46 insertions(+), 70 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 4b4012411011..ddac8dd9250f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -826,7 +826,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
memcpy(ie, pbuf, pbss_network->ie_length);
- if (pbss_network->infrastructure_mode != Ndis802_11APMode)
+ if (pbss_network->infrastructure_mode != NL80211_IFTYPE_AP)
return _FAIL;
pbss_network->rssi = 0;
@@ -1954,7 +1954,7 @@ void rtw_ap_restore_network(struct adapter *padapter)
char chk_alive_list[NUM_STA];
int i;
- rtw_setopmode_cmd(padapter, Ndis802_11APMode, false);
+ rtw_setopmode_cmd(padapter, NL80211_IFTYPE_AP, false);
set_channel_bwmode(padapter,
pmlmeext->cur_channel,
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index c1185c25ed36..e03aa0ba13dc 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -681,7 +681,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
struct security_priv *psecuritypriv = &padapter->securitypriv;
struct registry_priv *pregistrypriv = &padapter->registrypriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
- enum ndis_802_11_network_infrastructure ndis_network_mode = pnetwork->network.infrastructure_mode;
+ enum nl80211_iftype ndis_network_mode = pnetwork->network.infrastructure_mode;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
u32 tmp_len;
@@ -698,17 +698,15 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
/* for hidden ap to set fw_state here */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE) != true) {
switch (ndis_network_mode) {
- case Ndis802_11IBSS:
+ case NL80211_IFTYPE_ADHOC:
set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
break;
- case Ndis802_11Infrastructure:
+ case NL80211_IFTYPE_STATION:
set_fwstate(pmlmepriv, WIFI_STATION_STATE);
break;
- case Ndis802_11APMode:
- case Ndis802_11AutoUnknown:
- case Ndis802_11InfrastructureMax:
+ default:
break;
}
}
@@ -824,7 +822,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu
return res;
}
-u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infrastructure networktype, bool enqueue)
+u8 rtw_setopmode_cmd(struct adapter *padapter, enum nl80211_iftype networktype, bool enqueue)
{
struct cmd_obj *ph2c;
struct setopmode_parm *psetop;
diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
index c70541f95a73..9e3cb0f1d418 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
@@ -280,15 +280,15 @@ u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_1
}
u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
- enum ndis_802_11_network_infrastructure networktype)
+ enum nl80211_iftype networktype)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *cur_network = &pmlmepriv->cur_network;
- enum ndis_802_11_network_infrastructure *pold_state = &(cur_network->network.infrastructure_mode);
+ enum nl80211_iftype *pold_state = &(cur_network->network.infrastructure_mode);
if (*pold_state != networktype) {
- if (*pold_state == Ndis802_11APMode) {
- /* change to other mode from Ndis802_11APMode */
+ if (*pold_state == NL80211_IFTYPE_AP) {
+ /* change to other mode from AP mode */
cur_network->join_res = -1;
stop_ap_mode(padapter);
@@ -296,14 +296,14 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
spin_lock_bh(&pmlmepriv->lock);
- if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) || (*pold_state == Ndis802_11IBSS))
+ if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) || (*pold_state == NL80211_IFTYPE_ADHOC))
rtw_disassoc_cmd(padapter, 0, true);
if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) ||
(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true))
rtw_free_assoc_resources(padapter, 1);
- if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) {
+ if ((*pold_state == NL80211_IFTYPE_STATION) || (*pold_state == NL80211_IFTYPE_ADHOC)) {
if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
rtw_indicate_disconnect(padapter); /* will clr Linked_state; before this function, we must have checked whether issue dis-assoc_cmd or not */
}
@@ -313,23 +313,22 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
_clr_fwstate_(pmlmepriv, ~WIFI_NULL_STATE);
switch (networktype) {
- case Ndis802_11IBSS:
+ case NL80211_IFTYPE_ADHOC:
set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
break;
- case Ndis802_11Infrastructure:
+ case NL80211_IFTYPE_STATION:
set_fwstate(pmlmepriv, WIFI_STATION_STATE);
break;
- case Ndis802_11APMode:
+ case NL80211_IFTYPE_AP:
set_fwstate(pmlmepriv, WIFI_AP_STATE);
start_ap_mode(padapter);
/* rtw_indicate_connect(padapter); */
break;
- case Ndis802_11AutoUnknown:
- case Ndis802_11InfrastructureMax:
+ default:
break;
}
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index ddfc56f0253d..961f6ca7b691 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -51,7 +51,7 @@ int rtw_init_mlme_priv(struct adapter *padapter)
pmlmepriv->pscanned = NULL;
pmlmepriv->fw_state = WIFI_STATION_STATE; /* Must sync with rtw_wdev_alloc() */
- pmlmepriv->cur_network.network.infrastructure_mode = Ndis802_11AutoUnknown;
+ pmlmepriv->cur_network.network.infrastructure_mode = NL80211_IFTYPE_UNSPECIFIED;
pmlmepriv->scan_mode = SCAN_ACTIVE;/* 1: active, 0: passive. Maybe someday we should rename this varable to "active_mode" (Jeff) */
spin_lock_init(&pmlmepriv->lock);
@@ -1056,7 +1056,7 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net
/* update fw_state will clr _FW_UNDER_LINKING here indirectly */
switch (pnetwork->network.infrastructure_mode) {
- case Ndis802_11Infrastructure:
+ case NL80211_IFTYPE_STATION:
if (pmlmepriv->fw_state & WIFI_UNDER_WPS)
pmlmepriv->fw_state = WIFI_STATION_STATE | WIFI_UNDER_WPS;
@@ -1064,7 +1064,7 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net
pmlmepriv->fw_state = WIFI_STATION_STATE;
break;
- case Ndis802_11IBSS:
+ case NL80211_IFTYPE_ADHOC:
pmlmepriv->fw_state = WIFI_ADHOC_STATE;
break;
default:
@@ -2145,7 +2145,7 @@ void rtw_update_registrypriv_dev_network(struct adapter *adapter)
pdev_network->configuration.ds_config = (pregistrypriv->channel);
- if (cur_network->network.infrastructure_mode == Ndis802_11IBSS)
+ if (cur_network->network.infrastructure_mode == NL80211_IFTYPE_ADHOC)
pdev_network->configuration.atim_window = (0);
pdev_network->infrastructure_mode = (cur_network->network.infrastructure_mode);
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 5f00fe282d1b..0fba1639b20b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -4003,10 +4003,10 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
val16 = rtw_get_capability((struct wlan_bssid_ex *)bssid);
if (val16 & BIT(0)) {
- bssid->infrastructure_mode = Ndis802_11Infrastructure;
+ bssid->infrastructure_mode = NL80211_IFTYPE_STATION;
memcpy(bssid->mac_address, GetAddr2Ptr(pframe), ETH_ALEN);
} else {
- bssid->infrastructure_mode = Ndis802_11IBSS;
+ bssid->infrastructure_mode = NL80211_IFTYPE_ADHOC;
memcpy(bssid->mac_address, GetAddr3Ptr(pframe), ETH_ALEN);
}
@@ -5171,15 +5171,15 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct setopmode_parm *psetop = (struct setopmode_parm *)pbuf;
- if (psetop->mode == Ndis802_11APMode) {
+ if (psetop->mode == NL80211_IFTYPE_AP) {
pmlmeinfo->state = WIFI_FW_AP_STATE;
type = _HW_STATE_AP_;
/* start_ap_mode(padapter); */
- } else if (psetop->mode == Ndis802_11Infrastructure) {
+ } else if (psetop->mode == NL80211_IFTYPE_STATION) {
pmlmeinfo->state &= ~(BIT(0) | BIT(1));/* clear state */
pmlmeinfo->state |= WIFI_FW_STATION_STATE;/* set to STATION_STATE */
type = _HW_STATE_STATION_;
- } else if (psetop->mode == Ndis802_11IBSS) {
+ } else if (psetop->mode == NL80211_IFTYPE_ADHOC) {
type = _HW_STATE_ADHOC_;
} else {
type = _HW_STATE_NOLINK_;
@@ -5188,7 +5188,7 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)
rtw_hal_set_hwreg(padapter, HW_VAR_SET_OPMODE, (u8 *)(&type));
/* set_msr(padapter, type); */
- if (psetop->mode == Ndis802_11APMode) {
+ if (psetop->mode == NL80211_IFTYPE_AP) {
/* Do this after port switch to */
/* prevent from downloading rsvd page to wrong port */
rtw_btcoex_MediaStatusNotify(padapter, 1); /* connect */
@@ -5211,7 +5211,7 @@ u8 createbss_hdl(struct adapter *padapter, u8 *pbuf)
}
/* below is for ad-hoc master */
- if (pparm->network.infrastructure_mode == Ndis802_11IBSS) {
+ if (pparm->network.infrastructure_mode == NL80211_IFTYPE_ADHOC) {
rtw_joinbss_reset(padapter);
pmlmeext->cur_bwmode = CHANNEL_WIDTH_20;
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 27c0c0198714..d0b5e572d7d4 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -40,18 +40,18 @@ void rtw_hal_dm_init(struct adapter *padapter)
static void rtw_hal_init_opmode(struct adapter *padapter)
{
- enum ndis_802_11_network_infrastructure networkType = Ndis802_11InfrastructureMax;
+ enum nl80211_iftype networkType = NL80211_IFTYPE_UNSPECIFIED;
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
signed int fw_state;
fw_state = get_fwstate(pmlmepriv);
if (fw_state & WIFI_ADHOC_STATE)
- networkType = Ndis802_11IBSS;
+ networkType = NL80211_IFTYPE_ADHOC;
else if (fw_state & WIFI_STATION_STATE)
- networkType = Ndis802_11Infrastructure;
+ networkType = NL80211_IFTYPE_STATION;
else if (fw_state & WIFI_AP_STATE)
- networkType = Ndis802_11APMode;
+ networkType = NL80211_IFTYPE_AP;
else
return;
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
index 12416e499ac3..467d369a16d9 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
@@ -245,19 +245,19 @@ static void ConstructNullFunctionData(
SetPwrMgt(fctrl);
switch (cur_network->network.infrastructure_mode) {
- case Ndis802_11Infrastructure:
+ case NL80211_IFTYPE_STATION:
SetToDs(fctrl);
ether_addr_copy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)));
ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
ether_addr_copy(pwlanhdr->addr3, StaAddr);
break;
- case Ndis802_11APMode:
+ case NL80211_IFTYPE_AP:
SetFrDs(fctrl);
ether_addr_copy(pwlanhdr->addr1, StaAddr);
ether_addr_copy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network)));
ether_addr_copy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)));
break;
- case Ndis802_11IBSS:
+ case NL80211_IFTYPE_ADHOC:
default:
ether_addr_copy(pwlanhdr->addr1, StaAddr);
ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h b/drivers/staging/rtl8723bs/include/rtw_cmd.h
index c4c3edee809d..a42493f2fa6d 100644
--- a/drivers/staging/rtl8723bs/include/rtw_cmd.h
+++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h
@@ -586,7 +586,7 @@ extern u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8
extern u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork);
u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueue);
-extern u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infrastructure networktype, bool enqueue);
+extern u8 rtw_setopmode_cmd(struct adapter *padapter, enum nl80211_iftype networktype, bool enqueue);
extern u8 rtw_setrfintfs_cmd(struct adapter *padapter, u8 mode);
extern u8 rtw_gettssi_cmd(struct adapter *padapter, u8 offset, u8 *pval);
diff --git a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
index ab349de733c8..5c6cfc482731 100644
--- a/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
+++ b/drivers/staging/rtl8723bs/include/rtw_ioctl_set.h
@@ -14,7 +14,7 @@ u8 rtw_set_802_11_authentication_mode(struct adapter *pdapter, enum ndis_802_11_
u8 rtw_set_802_11_add_wep(struct adapter *padapter, struct ndis_802_11_wep *wep);
u8 rtw_set_802_11_disassociate(struct adapter *padapter);
u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_ssid *pssid, int ssid_max_num);
-u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter, enum ndis_802_11_network_infrastructure networktype);
+u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter, enum nl80211_iftype networktype);
u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid);
u8 rtw_set_802_11_connect(struct adapter *padapter, u8 *bssid, struct ndis_802_11_ssid *ssid);
diff --git a/drivers/staging/rtl8723bs/include/wlan_bssdef.h b/drivers/staging/rtl8723bs/include/wlan_bssdef.h
index 812a68394268..bcc5a1712670 100644
--- a/drivers/staging/rtl8723bs/include/wlan_bssdef.h
+++ b/drivers/staging/rtl8723bs/include/wlan_bssdef.h
@@ -42,14 +42,6 @@ struct ndis_802_11_conf {
u32 ds_config; /* Frequency, units are kHz */
};
-enum ndis_802_11_network_infrastructure {
- Ndis802_11IBSS,
- Ndis802_11Infrastructure,
- Ndis802_11AutoUnknown,
- Ndis802_11InfrastructureMax, /* Not a real value, defined as upper bound */
- Ndis802_11APMode,
-};
-
struct ndis_802_11_fix_ie {
u8 time_stamp[8];
u16 beacon_interval;
@@ -125,10 +117,6 @@ struct ndis_802_11_wep {
/* MIC check time, 60 seconds. */
#define MIC_CHECK_TIME 60000000
-#ifndef Ndis802_11APMode
-#define Ndis802_11APMode (Ndis802_11InfrastructureMax + 1)
-#endif
-
struct wlan_phy_info {
u8 signal_strength;/* in percentage) */
u8 signal_quality;/* in percentage) */
@@ -161,7 +149,7 @@ struct wlan_bssid_ex {
long rssi;/* in dBM, raw data , get from PHY) */
enum ndis_802_11_network_type network_type_in_use;
struct ndis_802_11_conf configuration;
- enum ndis_802_11_network_infrastructure infrastructure_mode;
+ enum nl80211_iftype infrastructure_mode;
NDIS_802_11_RATES_EX supported_rates;
struct wlan_phy_info phy_info;
u32 ie_length;
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index fd3bae31b0ed..cd8fa486404f 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1027,7 +1027,6 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
struct vif_params *params)
{
enum nl80211_iftype old_type;
- enum ndis_802_11_network_infrastructure networkType;
struct adapter *padapter = rtw_netdev_priv(ndev);
struct wireless_dev *rtw_wdev = padapter->rtw_wdev;
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
@@ -1057,30 +1056,22 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
pmlmeext->action_public_dialog_token = 0xff;
}
- switch (type) {
- case NL80211_IFTYPE_ADHOC:
- networkType = Ndis802_11IBSS;
- break;
- case NL80211_IFTYPE_STATION:
- networkType = Ndis802_11Infrastructure;
- break;
- case NL80211_IFTYPE_AP:
- networkType = Ndis802_11APMode;
- break;
- default:
+ if (type != NL80211_IFTYPE_ADHOC &&
+ type != NL80211_IFTYPE_STATION &&
+ type != NL80211_IFTYPE_AP) {
ret = -EOPNOTSUPP;
goto exit;
}
rtw_wdev->iftype = type;
- if (rtw_set_802_11_infrastructure_mode(padapter, networkType) == false) {
+ if (rtw_set_802_11_infrastructure_mode(padapter, type) == false) {
rtw_wdev->iftype = old_type;
ret = -EPERM;
goto exit;
}
- rtw_setopmode_cmd(padapter, networkType, true);
+ rtw_setopmode_cmd(padapter, type, true);
exit:
@@ -1610,12 +1601,12 @@ static int cfg80211_rtw_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
rtw_wdev->iftype = NL80211_IFTYPE_STATION;
- if (rtw_set_802_11_infrastructure_mode(padapter, Ndis802_11Infrastructure) == false) {
+ if (rtw_set_802_11_infrastructure_mode(padapter, NL80211_IFTYPE_STATION) == false) {
rtw_wdev->iftype = old_type;
ret = -EPERM;
goto leave_ibss;
}
- rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure, true);
+ rtw_setopmode_cmd(padapter, NL80211_IFTYPE_STATION, true);
}
leave_ibss:
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index e943dcea1a21..c33a3137845f 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -19,7 +19,7 @@ static int rtw_rfintfs = HWPI;
static int rtw_lbkmode;/* RTL8712_AIR_TRX; */
-static int rtw_network_mode = Ndis802_11IBSS;/* Ndis802_11Infrastructure;infra, ad-hoc, auto */
+static int rtw_network_mode = NL80211_IFTYPE_ADHOC;/* infra, ad-hoc, auto */
/* struct ndis_802_11_ssid ssid; */
static int rtw_channel = 1;/* ad-hoc support requirement */
static int rtw_wireless_mode = WIRELESS_11BG_24N;
--
2.25.1
^ permalink raw reply related
* Re: [PATCH] staging: iio: adc: ad7816: drop busy pin requirement for ad7816
From: Taha Narimani @ 2026-06-01 15:40 UTC (permalink / raw)
To: Dan Carpenter
Cc: Nishad Kamdar, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Greg Kroah-Hartman, open list:STAGING - INDUSTRIAL IO,
open list:STAGING SUBSYSTEM, open list
In-Reply-To: <ah1u6r2NemqKd2k7@stanley.mountain>
Hi Dan,
Thank you very much for the review and the excellent suggestion.
Using devm_gpiod_get_optional() and checking for NULL is indeed a much
cleaner and more elegant approach than hardcoding the chip IDs. I
completely agree and will implement this logic in v2.
I also apologize for the corrupted patch format. I will ensure my git
send-email configuration is properly fixed for the next submission.
I will wait a few days to allow time for any further comments from
Nishad or others before sending out the updated v2 patch.
Thank you again for your time and guidance!
Best regards,
Taha Narimani
On Mon, Jun 1, 2026 at 3:07 PM Dan Carpenter <error27@gmail.com> wrote:
>
> On Sat, May 30, 2026 at 05:35:12PM +0000, Taha Narimani wrote:
> > According to the AD7816/7/8 datasheet, the AD7816 is an 8-pin device
> > and does not possess a BUSY pin. The BUSY pin is exclusive to the
> > 16-pin AD7817.
> >
> > The driver previously requested a 'busy' GPIO unconditionally for both
> > the AD7816 and AD7817. If a device tree correctly modeled the hardware
> > by omitting the busy-gpios property for the AD7816, devm_gpiod_get()
> > would return -ENOENT and cause the probe to fail.
> >
> > Fix this by restricting the busy GPIO request strictly to the AD7817.
> >
> > Signed-off-by: Taha Narimani <tahanarimani3443@gmail.com>
>
> The patch is corrupted.
>
> Otherwise this seems reasonable enough. (I haven't read the datasheet
> but I trust that you have). Let's add Nishad to the CC list since he
> is the one who first limitted it to not check ID_AD7818.
>
> The other way to solve this would be to use devm_gpiod_get_optional()
> in the probe() function and test for NULL in ad7816_spi_read(). I
> think this would be a cleaner solution because then it works based
> on the device trees instead of having to hardcode which devices
> have it in the driver itself.
>
> regards,
> dan carpenter
>
^ permalink raw reply
* [PATCH 2/2] staging: rtl8723bs: remove unused 'oui' parameter from update_beacon()
From: Nikolay Kulikov @ 2026-06-01 15:01 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Nikolay Kulikov
In-Reply-To: <20260601150253.69930-1-nikolayof23@gmail.com>
After deleting one of the switch-case branches, this parameter became
unused, so remove it.
Signed-off-by: Nikolay Kulikov <nikolayof23@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 32 +++++++++++-----------
drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
drivers/staging/rtl8723bs/core/rtw_recv.c | 4 +--
drivers/staging/rtl8723bs/core/rtw_xmit.c | 8 +++---
drivers/staging/rtl8723bs/include/rtw_ap.h | 2 +-
5 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 316f879923f5..febeb66469f5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -232,7 +232,7 @@ void expire_timeout_chk(struct adapter *padapter)
/* to update bcn with tim_bitmap for this station */
pstapriv->tim_bitmap |= BIT(psta->aid);
- update_beacon(padapter, WLAN_EID_TIM, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, true);
if (!pmlmeext->active_keep_alive_check)
continue;
@@ -739,7 +739,7 @@ void start_bss_network(struct adapter *padapter)
rtw_get_capability((struct wlan_bssid_ex *)pnetwork));
if (pmlmeext->bstart_bss) {
- update_beacon(padapter, WLAN_EID_TIM, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, true);
/* issue beacon frame */
send_beacon(padapter);
@@ -1336,7 +1336,7 @@ static void update_bcn_rsn_ie(struct adapter *padapter)
{
}
-void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
+void update_beacon(struct adapter *padapter, u8 ie_id, u8 tx)
{
struct mlme_priv *pmlmepriv;
struct mlme_ext_priv *pmlmeext;
@@ -1513,7 +1513,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
(pmlmepriv->num_sta_no_short_preamble == 1)) {
beacon_updated = true;
- update_beacon(padapter, 0xFF, NULL, true);
+ update_beacon(padapter, 0xFF, true);
}
}
} else {
@@ -1525,7 +1525,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
(pmlmepriv->num_sta_no_short_preamble == 0)) {
beacon_updated = true;
- update_beacon(padapter, 0xFF, NULL, true);
+ update_beacon(padapter, 0xFF, true);
}
}
}
@@ -1538,7 +1538,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
if (pmlmepriv->num_sta_non_erp == 1) {
beacon_updated = true;
- update_beacon(padapter, WLAN_EID_ERP_INFO, NULL, true);
+ update_beacon(padapter, WLAN_EID_ERP_INFO, true);
}
}
} else {
@@ -1549,7 +1549,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
if (pmlmepriv->num_sta_non_erp == 0) {
beacon_updated = true;
- update_beacon(padapter, WLAN_EID_ERP_INFO, NULL, true);
+ update_beacon(padapter, WLAN_EID_ERP_INFO, true);
}
}
}
@@ -1563,7 +1563,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
(pmlmepriv->num_sta_no_short_slot_time == 1)) {
beacon_updated = true;
- update_beacon(padapter, 0xFF, NULL, true);
+ update_beacon(padapter, 0xFF, true);
}
}
} else {
@@ -1575,7 +1575,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) &&
(pmlmepriv->num_sta_no_short_slot_time == 0)) {
beacon_updated = true;
- update_beacon(padapter, 0xFF, NULL, true);
+ update_beacon(padapter, 0xFF, true);
}
}
}
@@ -1610,8 +1610,8 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
}
if (rtw_ht_operation_update(padapter) > 0) {
- update_beacon(padapter, WLAN_EID_HT_CAPABILITY, NULL, false);
- update_beacon(padapter, WLAN_EID_HT_OPERATION, NULL, true);
+ update_beacon(padapter, WLAN_EID_HT_CAPABILITY, false);
+ update_beacon(padapter, WLAN_EID_HT_OPERATION, true);
}
/* update associated stations cap. */
@@ -1633,7 +1633,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
if (pmlmeext->cur_wireless_mode > WIRELESS_11B &&
pmlmepriv->num_sta_no_short_preamble == 0){
beacon_updated = true;
- update_beacon(padapter, 0xFF, NULL, true);
+ update_beacon(padapter, 0xFF, true);
}
}
@@ -1642,7 +1642,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
pmlmepriv->num_sta_non_erp--;
if (pmlmepriv->num_sta_non_erp == 0) {
beacon_updated = true;
- update_beacon(padapter, WLAN_EID_ERP_INFO, NULL, true);
+ update_beacon(padapter, WLAN_EID_ERP_INFO, true);
}
}
@@ -1652,7 +1652,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
if (pmlmeext->cur_wireless_mode > WIRELESS_11B &&
pmlmepriv->num_sta_no_short_slot_time == 0){
beacon_updated = true;
- update_beacon(padapter, 0xFF, NULL, true);
+ update_beacon(padapter, 0xFF, true);
}
}
@@ -1672,8 +1672,8 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
}
if (rtw_ht_operation_update(padapter) > 0) {
- update_beacon(padapter, WLAN_EID_HT_CAPABILITY, NULL, false);
- update_beacon(padapter, WLAN_EID_HT_OPERATION, NULL, true);
+ update_beacon(padapter, WLAN_EID_HT_CAPABILITY, false);
+ update_beacon(padapter, WLAN_EID_HT_OPERATION, true);
}
return beacon_updated;
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index b932670f5d63..f182b10b0f45 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1526,7 +1526,7 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
pstapriv->sta_dz_bitmap &= ~BIT(0);
if (update_tim)
- update_beacon(padapter, WLAN_EID_TIM, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, true);
} else {/* re check again */
rtw_chk_hi_queue_cmd(padapter);
}
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 86c5e2c4e7dd..a75231c55310 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1009,7 +1009,7 @@ static signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_
/* update BCN for TIM IE */
/* update_BCNTIM(padapter); */
- update_beacon(padapter, WLAN_EID_TIM, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, true);
}
/* spin_unlock_bh(&psta->sleep_q.lock); */
@@ -1031,7 +1031,7 @@ static signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_
/* update BCN for TIM IE */
/* update_BCNTIM(padapter); */
- update_beacon(padapter, WLAN_EID_TIM, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, true);
}
}
}
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 444966c0de7f..23136d985e7c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -2083,7 +2083,7 @@ signed int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct x
pstapriv->sta_dz_bitmap |= BIT(0);
if (update_tim)
- update_beacon(padapter, WLAN_EID_TIM, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, true);
else
chk_bmc_sleepq_cmd(padapter);
@@ -2138,7 +2138,7 @@ signed int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct x
if (update_tim)
/* update BCN for TIM IE */
- update_beacon(padapter, WLAN_EID_TIM, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, true);
}
ret = true;
@@ -2333,7 +2333,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta)
spin_unlock_bh(&pxmitpriv->lock);
if (update_mask)
- update_beacon(padapter, WLAN_EID_TIM, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, true);
}
void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *psta)
@@ -2393,7 +2393,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst
if ((psta->sleepq_ac_len == 0) && (!psta->has_legacy_ac) && (wmmps_ac)) {
pstapriv->tim_bitmap &= ~BIT(psta->aid);
- update_beacon(padapter, WLAN_EID_TIM, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, true);
}
}
diff --git a/drivers/staging/rtl8723bs/include/rtw_ap.h b/drivers/staging/rtl8723bs/include/rtw_ap.h
index 83e835eb6513..866aa8386931 100644
--- a/drivers/staging/rtl8723bs/include/rtw_ap.h
+++ b/drivers/staging/rtl8723bs/include/rtw_ap.h
@@ -10,7 +10,7 @@
void init_mlme_ap_info(struct adapter *padapter);
void free_mlme_ap_info(struct adapter *padapter);
/* void update_BCNTIM(struct adapter *padapter); */
-void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx);
+void update_beacon(struct adapter *padapter, u8 ie_id, u8 tx);
void add_ratid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level);
void expire_timeout_chk(struct adapter *padapter);
void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta);
--
2.54.0
^ permalink raw reply related
* [PATCH 1/2] staging: rtl8723bs: remove unused case from update_beacon()
From: Nikolay Kulikov @ 2026-06-01 15:01 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Nikolay Kulikov
In-Reply-To: <20260601150253.69930-1-nikolayof23@gmail.com>
The update_beacon() function is never called with 'ie_id' equal to
'WLAN_EID_VENDOR_SPECIFIC', meaning this case branch will never be
called, so remove it and several related functions.
Removing this case branch also fixes a possible null pointer
dereference in update_bcn_vendor_spec() if 'oui' is NULL, since
its value is not checked in any way.
Signed-off-by: Nikolay Kulikov <nikolayof23@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 84 -------------------------
1 file changed, 84 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 065850a9e894..316f879923f5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1336,84 +1336,6 @@ static void update_bcn_rsn_ie(struct adapter *padapter)
{
}
-static void update_bcn_wpa_ie(struct adapter *padapter)
-{
-}
-
-static void update_bcn_wmm_ie(struct adapter *padapter)
-{
-}
-
-static void update_bcn_wps_ie(struct adapter *padapter)
-{
- u8 *pwps_ie = NULL;
- u8 *pwps_ie_src;
- u8 *premainder_ie;
- u8 *pbackup_remainder_ie = NULL;
-
- unsigned int wps_ielen = 0, wps_offset, remainder_ielen;
- struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
- struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network;
- unsigned char *ie = pnetwork->ies;
- u32 ielen = pnetwork->ie_length;
-
- pwps_ie = rtw_get_wps_ie(ie + _FIXED_IE_LENGTH_,
- ielen - _FIXED_IE_LENGTH_,
- NULL,
- &wps_ielen);
-
- if (!pwps_ie || wps_ielen == 0)
- return;
-
- pwps_ie_src = pmlmepriv->wps_beacon_ie;
- if (!pwps_ie_src)
- return;
-
- wps_offset = (unsigned int)(pwps_ie - ie);
-
- premainder_ie = pwps_ie + wps_ielen;
-
- remainder_ielen = ielen - wps_offset - wps_ielen;
-
- if (remainder_ielen)
- pbackup_remainder_ie = kmemdup(premainder_ie, remainder_ielen, GFP_ATOMIC);
-
- wps_ielen = (unsigned int)pwps_ie_src[1];/* to get ie data len */
- if ((wps_offset + wps_ielen + 2 + remainder_ielen) <= MAX_IE_SZ) {
- memcpy(pwps_ie, pwps_ie_src, wps_ielen + 2);
- pwps_ie += (wps_ielen + 2);
-
- if (pbackup_remainder_ie)
- memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen);
-
- /* update ie_length */
- pnetwork->ie_length = wps_offset + (wps_ielen + 2) + remainder_ielen;
- }
-
- kfree(pbackup_remainder_ie);
-}
-
-static void update_bcn_p2p_ie(struct adapter *padapter)
-{
-}
-
-static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui)
-{
- if (!memcmp(RTW_WPA_OUI, oui, 4))
- update_bcn_wpa_ie(padapter);
-
- else if (!memcmp(WMM_OUI, oui, 4))
- update_bcn_wmm_ie(padapter);
-
- else if (!memcmp(WPS_OUI, oui, 4))
- update_bcn_wps_ie(padapter);
-
- else if (!memcmp(P2P_OUI, oui, 4))
- update_bcn_p2p_ie(padapter);
-}
-
void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
{
struct mlme_priv *pmlmepriv;
@@ -1467,12 +1389,6 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
break;
- case WLAN_EID_VENDOR_SPECIFIC:
-
- update_bcn_vendor_spec_ie(padapter, oui);
-
- break;
-
default:
break;
}
--
2.54.0
^ permalink raw reply related
* [PATCH 0/2] staging: rtl8723bs: remove unreachable code in
From: Nikolay Kulikov @ 2026-06-01 15:01 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Nikolay Kulikov
This series removes an unreachable switch-case branch in the
update_beacon() function. This branch doesn't check the value of the
'oui' pointer, which could lead to a NULL dereference.
Found with cppcheck:
core/rtw_ap.c:1404:27: error: Null pointer dereference: oui [ctunullpointer]
if (!memcmp(RTW_WPA_OUI, oui, 4))
^
core/rtw_ap.c:235:19: note: Calling function update_beacon, 3rd argument is null
update_beacon(padapter, WLAN_EID_TIM, NULL, true);
^
core/rtw_ap.c:1472:3: note: Calling function update_bcn_vendor_spec_ie, 2nd argument is null
update_bcn_vendor_spec_ie(padapter, oui);
^
core/rtw_ap.c:1404:27: note: Dereferencing argument oui that is null
if (!memcmp(RTW_WPA_OUI, oui, 4))
^
Nikolay Kulikov (2):
staging: rtl8723bs: remove unused case from update_beacon()
staging: rtl8723bs: remove unused 'oui' parameter from update_beacon()
drivers/staging/rtl8723bs/core/rtw_ap.c | 116 +++------------------
drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
drivers/staging/rtl8723bs/core/rtw_recv.c | 4 +-
drivers/staging/rtl8723bs/core/rtw_xmit.c | 8 +-
drivers/staging/rtl8723bs/include/rtw_ap.h | 2 +-
5 files changed, 24 insertions(+), 108 deletions(-)
base-commit: 7cb1c5b32a2bfde961fff8d5204526b609bcb30a
--
2.54.0
^ permalink raw reply
* Re: [RFC] drivers/staging/axis-fifo: TODO file and subsystem direction
From: Andrew Lunn @ 2026-06-01 12:29 UTC (permalink / raw)
To: Grewstad
Cc: gregkh, jic23, jacobsfeder, linux-staging, linux-arm-kernel,
linux-kernel, hjk, davem, netdev
In-Reply-To: <CAD03fjah2GMedDtauPQjP0++3USpy6tm3AUemgAjVHS=5Nirtg@mail.gmail.com>
On Mon, Jun 01, 2026 at 11:35:14AM +0530, Grewstad wrote:
> On Mon, Jun 1, 2026 at 1:22 AM Andrew Lunn <andrew@lunn.ch> wrote:
> >
> >
> > In addition to what GregKH said, look at the vendor information:
> >
> > https://docs.amd.com/r/en-US/pg080-axi-fifo-mm-s/Core-Overview
> >
> > The AXI4-Stream FIFO core was designed to provide memory-mapped
> > access to an AXI4-Stream interface connected to other IP (such as
> > the AXI Ethernet core). Systems must be built through the AMD
> > Vivado™ Design Suite to attach the AXI4-Stream FIFO core, AXI
> > Ethernet core ...
> >
> > when used for Ethernet, a uAPI is not needed. The FIFO driver would
> > just expose an kernel internal API the Ethernet driver would use. Are
> > there any Ethernet devices using it? Is there a driver for the AXI
> > Ethernet core?
>
> As I said to Greg K-H, it's 'chameleon' hardware because we don't know
> what it'll be used for. It could be SDR or Ethernet or whatever it is
> programmed for. The main thing is that it is a streaming interface.
> But we cannot assume the use case.
Flip that around. What is it actually used for today? Make sure it has
the correct APIs needed for what it does now. New APIs can always be
added latter, especially if they are in-kernel, code to glue it to an
Ethernet driver for example.
However, a grep for XIL_AXIS_FIFO suggests nothing in-kernel actually
uses it.
Are there any real users from user space? You talk about SDR, does GNU
Radio use it? Using what hardware?
If you have no idea how the code is used, you cannot say what the
correct interface is....
Andrew
^ permalink raw reply
* Re: [PATCH] staging: iio: adc: ad7816: drop busy pin requirement for ad7816
From: Dan Carpenter @ 2026-06-01 11:37 UTC (permalink / raw)
To: Taha Narimani, Nishad Kamdar
Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
David Lechner, Nuno Sá, Andy Shevchenko, Greg Kroah-Hartman,
open list:STAGING - INDUSTRIAL IO, open list:STAGING SUBSYSTEM,
open list
In-Reply-To: <20260530173514.56640-1-tahanarimani3443@gmail.com>
On Sat, May 30, 2026 at 05:35:12PM +0000, Taha Narimani wrote:
> According to the AD7816/7/8 datasheet, the AD7816 is an 8-pin device
> and does not possess a BUSY pin. The BUSY pin is exclusive to the
> 16-pin AD7817.
>
> The driver previously requested a 'busy' GPIO unconditionally for both
> the AD7816 and AD7817. If a device tree correctly modeled the hardware
> by omitting the busy-gpios property for the AD7816, devm_gpiod_get()
> would return -ENOENT and cause the probe to fail.
>
> Fix this by restricting the busy GPIO request strictly to the AD7817.
>
> Signed-off-by: Taha Narimani <tahanarimani3443@gmail.com>
The patch is corrupted.
Otherwise this seems reasonable enough. (I haven't read the datasheet
but I trust that you have). Let's add Nishad to the CC list since he
is the one who first limitted it to not check ID_AD7818.
The other way to solve this would be to use devm_gpiod_get_optional()
in the probe() function and test for NULL in ad7816_spi_read(). I
think this would be a cleaner solution because then it works based
on the device trees instead of having to hardcode which devices
have it in the driver itself.
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH v2] staging: rtl8723bs: remove unnecessary parentheses
From: Dan Carpenter @ 2026-06-01 11:29 UTC (permalink / raw)
To: Eugene Mavick
Cc: gregkh, khomenkov, tomasz.unger, arthur.stupa, jannik,
linux-staging, linux-kernel
In-Reply-To: <20260531061022.573089-1-mavick4022@gmail.com>
On Sun, May 31, 2026 at 02:10:22PM +0800, Eugene Mavick wrote:
> Remove unnecessary parentheses to clear checkpatch.pl warnings
>
> Example of fixed warnings:
> CHECK: Unnecessary parentheses around dvobj->cam_cache[id]
> CHECK: Unnecessary parentheses around 'val != 0xfe'
>
> Checkpatch warnings regarding line length above 100 columns on modified
> lines were also fixed
>
> Signed-off-by: Eugene Mavick <mavick4022@gmail.com>
> ---
> V1->V2:
> Fixed following checkpatch warnings on modified lines:
> CHECK: Alignment should match open parenthesis(line 1114, 1249)
> CHECK: Logical continuations should be on the previous line(line 1251)
>
> v1: https://lore.kernel.org/all/20260530031621.443015-1-mavick4022@gmail.com/
>
> .../staging/rtl8723bs/core/rtw_wlan_util.c | 93 ++++++++++---------
> 1 file changed, 49 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> index 1d37c2d5b10d..84e9772a39c2 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> @@ -118,7 +118,7 @@ int is_basicrate(struct adapter *padapter, unsigned char rate)
> for (i = 0; i < NumRates; i++) {
> val = pmlmeext->basicrate[i];
>
> - if ((val != 0xff) && (val != 0xfe))
> + if (val != 0xff && val != 0xfe)
Just leave this one as-is. (staging rules). We deliberately silenced
this checkpatch warning so it's weird for checkpatch to complain.
Same for the other conditions.
> if (rate == ratetbl_val_2wifirate(val))
> return true;
> }
> @@ -351,7 +351,7 @@ int is_client_associated_to_ap(struct adapter *padapter)
> return _FAIL;
>
> pmlmeext = &padapter->mlmeextpriv;
> - pmlmeinfo = &(pmlmeext->mlmext_info);
> + pmlmeinfo = &pmlmeext->mlmext_info;
These changes are fine though. Can you resend without the condtion
changes?
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH] staging: greybus: audio_manager_module: add newlines to sysfs_emit calls
From: Dan Carpenter @ 2026-06-01 11:12 UTC (permalink / raw)
To: Colton Spurgin
Cc: gregkh, vaibhav.sr, mgreer, johan, elder, greybus-dev,
linux-staging, linux-kernel
In-Reply-To: <20260531005007.98382-1-colton@coltonspurgin.tech>
On Sat, May 30, 2026 at 07:50:07PM -0500, Colton Spurgin wrote:
> sysfs_emit() format strings should include a terminating newline.
> Add missing '\n' after 6 formatted strings in show functions.
>
> Signed-off-by: Colton Spurgin <colton@coltonspurgin.tech>
This checkpatch warning only applies to new code. For existing code
you risk breaking userspace.
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH] staging: rtl8723bs: remove redundant parentheses
From: Dan Carpenter @ 2026-06-01 11:11 UTC (permalink / raw)
To: Ben O'Bryan; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel
In-Reply-To: <20260531004140.99743-1-obryanbw@gmail.com>
On Sat, May 30, 2026 at 07:41:03PM -0500, Ben O'Bryan wrote:
> Remove redundant parentheses around type checks
> and align conditional lines to improve readability
>
> Signed-off-by: Ben O'Bryan <obryanbw@gmail.com>
> ---
>
> This is my first patch to the kernel so please let me know if
> I've done anything wrong.
>
> This patch is mostly for me to verify my environment. Assuming
> everything goes smoothly, I hope to continue to contribute
> more formatting patches as I get more comfortable contributing.
>
We don't mind the extra parentheses in staging so we disabled
that checkpatch warning.
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH] staging: sm750fb: remove duplicate init_status structure
From: Dan Carpenter @ 2026-06-01 11:09 UTC (permalink / raw)
To: Hungyu Lin
Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
linux-kernel
In-Reply-To: <20260530222432.4303-1-dennylin0707@gmail.com>
On Sat, May 30, 2026 at 10:24:32PM +0000, Hungyu Lin wrote:
> struct init_status duplicates struct initchip_param and is only used
> within the sm750fb driver.
>
> Replace the remaining users of struct init_status with
> struct initchip_param, remove the duplicate structure and eliminate
> the unnecessary cast in hw_sm750_inithw().
>
> No functional change intended.
>
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
Looks good to me. :)
Reviewed-by: Dan Carpenter <error27@gmail.com>
regards,
dan carpenter
^ permalink raw reply
* [PATCH 2/2] staging: rtl8723bs: fix alignment
From: Eugene Mavick @ 2026-06-01 9:37 UTC (permalink / raw)
To: gregkh
Cc: hansg, straube.linux, nikolayof23, mavick4022, khomenkov,
william.hansen.baird, maxwell2119, dikshakdevgan, arthur.stupa,
linux-staging, linux-kernel
In-Reply-To: <20260601093757.612130-1-mavick4022@gmail.com>
Fix alignment to improve code readability and clear checkpatch warning:
CHECK: Alignment should match open parenthesis
Signed-off-by: Eugene Mavick <mavick4022@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
index 02f8564d32a7..e534045dd467 100644
--- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
@@ -249,7 +249,7 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
/* init recv timer */
timer_setup(&preorder_ctrl->reordering_ctrl_timer,
- rtw_reordering_ctrl_timeout_handler, 0);
+ rtw_reordering_ctrl_timeout_handler, 0);
}
/* init for DM */
--
2.51.2
^ permalink raw reply related
* [PATCH 1/2] staging: rtl8723bs: fix line length warning
From: Eugene Mavick @ 2026-06-01 9:37 UTC (permalink / raw)
To: gregkh
Cc: hansg, straube.linux, nikolayof23, mavick4022, khomenkov,
william.hansen.baird, maxwell2119, dikshakdevgan, arthur.stupa,
linux-staging, linux-kernel
In-Reply-To: <20260601093757.612130-1-mavick4022@gmail.com>
Split comment exceeding 100 columns to improve readability and clear
checkpatch warning
Signed-off-by: Eugene Mavick <mavick4022@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
index a1b7fe843979..02f8564d32a7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
@@ -222,7 +222,8 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
/* Commented by Albert 2009/08/13 */
/* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
- /* In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */
+ /* This packet will be dropped by recv_decache function */
+ /* if we use the 0x00 as the default value for tid_rxseq variable. */
/* So, we initialize the tid_rxseq variable as the 0xffff. */
for (i = 0; i < 16; i++)
--
2.51.2
^ permalink raw reply related
* [PATCH 0/2] staging: rtl8723bs: rtw_sta_mgt cleanup series
From: Eugene Mavick @ 2026-06-01 9:37 UTC (permalink / raw)
To: gregkh
Cc: hansg, straube.linux, nikolayof23, mavick4022, khomenkov,
william.hansen.baird, maxwell2119, dikshakdevgan, arthur.stupa,
linux-staging, linux-kernel
Fix line length and indentation issues in core/rtw_sta_mgt.c
Eugene Mavick (2):
staging: rtl8723bs: fix line length warning
staging: rtl8723bs: fix alignment
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--
2.51.2
^ permalink raw reply
* [linux-6.12.y 4/4] HID: core: Fix size_t specifier in hid_report_raw_event()
From: Lee Jones @ 2026-06-01 8:36 UTC (permalink / raw)
To: lee, Jiri Kosina, Benjamin Tissoires, Filipe Laíns,
Bastien Nocera, Ping Cheng, Jason Gerecke, Viresh Kumar,
Johan Hovold, Alex Elder, Greg Kroah-Hartman, Sasha Levin,
Mario Limonciello (AMD), Kwok Kin Ming, linux-input, linux-kernel,
linux-usb, greybus-dev, linux-staging, bpf
Cc: stable, Nathan Chancellor, Miguel Ojeda, Linus Torvalds
In-Reply-To: <20260601083642.908433-1-lee@kernel.org>
From: Nathan Chancellor <nathan@kernel.org>
[ Upstream commit 4d3a2a466b8d68d852a1f3bbf11204b718428dc4 ]
When building for 32-bit platforms, for which 'size_t' is
'unsigned int', there are warnings around using the incorrect format
specifier to print bsize in hid_report_raw_event():
drivers/hid/hid-core.c:2054:29: error: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat]
2053 | hid_warn_ratelimited(hid, "Event data for report %d is incorrect (%d vs %ld)\n",
| ~~~
| %zu
2054 | report->id, csize, bsize);
| ^~~~~
drivers/hid/hid-core.c:2076:29: error: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat]
2075 | hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %ld)\n",
| ~~~
| %zu
2076 | report->id, rsize, bsize);
| ^~~~~
Use the proper 'size_t' format specifier, '%zu', to clear up the
warnings.
Cc: stable@vger.kernel.org
Fixes: 2c85c61d1332 ("HID: pass the buffer size to hid_report_raw_event")
Reported-by: Miguel Ojeda <ojeda@kernel.org>
Closes: https://lore.kernel.org/20260516020430.110135-1-ojeda@kernel.org/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 3ab135238832446399614e7a4bb796d620717806)
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/hid/hid-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index d9ea99cdb68e..87d990ada868 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2015,7 +2015,7 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
return 0;
if (unlikely(bsize < csize)) {
- hid_warn_ratelimited(hid, "Event data for report %d is incorrect (%d vs %ld)\n",
+ hid_warn_ratelimited(hid, "Event data for report %d is incorrect (%d vs %zu)\n",
report->id, csize, bsize);
return -EINVAL;
}
@@ -2037,7 +2037,7 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
rsize = max_buffer_size;
if (bsize < rsize) {
- hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %ld)\n",
+ hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %zu)\n",
report->id, rsize, bsize);
return -EINVAL;
}
--
2.54.0.823.g6e5bcc1fc9-goog
^ permalink raw reply related
* [linux-6.12.y 3/4] HID: core: introduce hid_safe_input_report()
From: Lee Jones @ 2026-06-01 8:36 UTC (permalink / raw)
To: lee, Jiri Kosina, Benjamin Tissoires, Filipe Laíns,
Bastien Nocera, Ping Cheng, Jason Gerecke, Viresh Kumar,
Johan Hovold, Alex Elder, Greg Kroah-Hartman, Sasha Levin,
Mario Limonciello (AMD), Kwok Kin Ming, linux-input, linux-kernel,
linux-usb, greybus-dev, linux-staging, bpf
Cc: stable, Jiri Kosina
In-Reply-To: <20260601083642.908433-1-lee@kernel.org>
From: Benjamin Tissoires <bentiss@kernel.org>
[ Upstream commit 206342541fc887ae919774a43942dc883161fece ]
hid_input_report() is used in too many places to have a commit that
doesn't cross subsystem borders. Instead of changing the API, introduce
a new one when things matters in the transport layers:
- usbhid
- i2chid
This effectively revert to the old behavior for those two transport
layers.
Fixes: 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing bogus memset()")
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 301338b8edadc67a42b1c86add975091e66768d9)
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/hid/hid-core.c | 25 +++++++++++++++++++++++++
drivers/hid/i2c-hid/i2c-hid-core.c | 7 ++++---
drivers/hid/usbhid/hid-core.c | 11 ++++++-----
include/linux/hid.h | 2 ++
4 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index ceff91722c3c..d9ea99cdb68e 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2146,6 +2146,7 @@ static int __hid_input_report(struct hid_device *hid, enum hid_report_type type,
* @interrupt: distinguish between interrupt and control transfers
*
* This is data entry for lower layers.
+ * Legacy, please use hid_safe_input_report() instead.
*/
int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
int interrupt)
@@ -2156,6 +2157,30 @@ int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data
}
EXPORT_SYMBOL_GPL(hid_input_report);
+/**
+ * hid_safe_input_report - report data from lower layer (usb, bt...)
+ *
+ * @hid: hid device
+ * @type: HID report type (HID_*_REPORT)
+ * @data: report contents
+ * @bufsize: allocated size of the data buffer
+ * @size: useful size of data parameter
+ * @interrupt: distinguish between interrupt and control transfers
+ *
+ * This is data entry for lower layers.
+ * Please use this function instead of the non safe version because we provide
+ * here the size of the buffer, allowing hid-core to make smarter decisions
+ * regarding the incoming buffer.
+ */
+int hid_safe_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data,
+ size_t bufsize, u32 size, int interrupt)
+{
+ return __hid_input_report(hid, type, data, bufsize, size, interrupt, 0,
+ false, /* from_bpf */
+ false /* lock_already_taken */);
+}
+EXPORT_SYMBOL_GPL(hid_safe_input_report);
+
bool hid_match_one_id(const struct hid_device *hdev,
const struct hid_device_id *id)
{
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index cf8ae0df0cda..8ce0535fc42d 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -568,9 +568,10 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
if (ihid->hid->group != HID_GROUP_RMI)
pm_wakeup_event(&ihid->client->dev, 0);
- hid_input_report(ihid->hid, HID_INPUT_REPORT,
- ihid->inbuf + sizeof(__le16),
- ret_size - sizeof(__le16), 1);
+ hid_safe_input_report(ihid->hid, HID_INPUT_REPORT,
+ ihid->inbuf + sizeof(__le16),
+ ihid->bufsize - sizeof(__le16),
+ ret_size - sizeof(__le16), 1);
}
return;
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index f14b46ce00cb..336ad7cf3d48 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -283,9 +283,9 @@ static void hid_irq_in(struct urb *urb)
break;
usbhid_mark_busy(usbhid);
if (!test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
- hid_input_report(urb->context, HID_INPUT_REPORT,
- urb->transfer_buffer,
- urb->actual_length, 1);
+ hid_safe_input_report(urb->context, HID_INPUT_REPORT,
+ urb->transfer_buffer, urb->transfer_buffer_length,
+ urb->actual_length, 1);
/*
* autosuspend refused while keys are pressed
* because most keyboards don't wake up when
@@ -482,9 +482,10 @@ static void hid_ctrl(struct urb *urb)
switch (status) {
case 0: /* success */
if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN)
- hid_input_report(urb->context,
+ hid_safe_input_report(urb->context,
usbhid->ctrl[usbhid->ctrltail].report->type,
- urb->transfer_buffer, urb->actual_length, 0);
+ urb->transfer_buffer, urb->transfer_buffer_length,
+ urb->actual_length, 0);
break;
case -ESHUTDOWN: /* unplug */
unplug = 1;
diff --git a/include/linux/hid.h b/include/linux/hid.h
index fdd401e4ebde..7d05b1edacd8 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -949,6 +949,8 @@ struct hid_field *hid_find_field(struct hid_device *hdev, unsigned int report_ty
int hid_set_field(struct hid_field *, unsigned, __s32);
int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
int interrupt);
+int hid_safe_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data,
+ size_t bufsize, u32 size, int interrupt);
struct hid_field *hidinput_get_led_field(struct hid_device *hid);
unsigned int hidinput_count_leds(struct hid_device *hid);
__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
--
2.54.0.823.g6e5bcc1fc9-goog
^ permalink raw reply related
* [linux-6.12.y 2/4] HID: pass the buffer size to hid_report_raw_event
From: Lee Jones @ 2026-06-01 8:36 UTC (permalink / raw)
To: lee, Jiri Kosina, Benjamin Tissoires, Filipe Laíns,
Bastien Nocera, Ping Cheng, Jason Gerecke, Viresh Kumar,
Johan Hovold, Alex Elder, Greg Kroah-Hartman, Sasha Levin,
Kwok Kin Ming, Mario Limonciello (AMD), linux-input, linux-kernel,
linux-usb, greybus-dev, linux-staging, bpf
Cc: stable, Jiri Kosina
In-Reply-To: <20260601083642.908433-1-lee@kernel.org>
From: Benjamin Tissoires <bentiss@kernel.org>
[ Upstream commit 2c85c61d1332e1e16f020d76951baf167dcb6f7a ]
commit 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing
bogus memset()") enforced the provided data to be at least the size of
the declared buffer in the report descriptor to prevent a buffer
overflow. However, we can try to be smarter by providing both the buffer
size and the data size, meaning that hid_report_raw_event() can make
better decision whether we should plaining reject the buffer (buffer
overflow attempt) or if we can safely memset it to 0 and pass it to the
rest of the stack.
Fixes: 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing bogus memset()")
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Acked-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Stable-dep-of: 206342541fc8 ("HID: core: introduce hid_safe_input_report()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 509c2605065004fc4cd86ee50a9350d402785307)
[Lee: Backported to linux-6.12.y and beyond]
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/hid/bpf/hid_bpf_dispatch.c | 6 +++--
drivers/hid/hid-core.c | 37 +++++++++++++++++++++---------
drivers/hid/hid-gfrm.c | 4 ++--
drivers/hid/hid-logitech-hidpp.c | 2 +-
drivers/hid/hid-multitouch.c | 2 +-
drivers/hid/hid-primax.c | 2 +-
drivers/hid/hid-vivaldi-common.c | 2 +-
drivers/hid/wacom_sys.c | 6 ++---
drivers/staging/greybus/hid.c | 2 +-
include/linux/hid.h | 4 ++--
include/linux/hid_bpf.h | 14 +++++++----
11 files changed, 51 insertions(+), 30 deletions(-)
diff --git a/drivers/hid/bpf/hid_bpf_dispatch.c b/drivers/hid/bpf/hid_bpf_dispatch.c
index 284861c166d9..b711d83dfde1 100644
--- a/drivers/hid/bpf/hid_bpf_dispatch.c
+++ b/drivers/hid/bpf/hid_bpf_dispatch.c
@@ -24,7 +24,8 @@ EXPORT_SYMBOL(hid_ops);
u8 *
dispatch_hid_bpf_device_event(struct hid_device *hdev, enum hid_report_type type, u8 *data,
- u32 *size, int interrupt, u64 source, bool from_bpf)
+ size_t *buf_size, u32 *size, int interrupt, u64 source,
+ bool from_bpf)
{
struct hid_bpf_ctx_kern ctx_kern = {
.ctx = {
@@ -74,6 +75,7 @@ dispatch_hid_bpf_device_event(struct hid_device *hdev, enum hid_report_type type
*size = ret;
}
+ *buf_size = ctx_kern.ctx.allocated_size;
return ctx_kern.data;
}
EXPORT_SYMBOL_GPL(dispatch_hid_bpf_device_event);
@@ -514,7 +516,7 @@ __hid_bpf_input_report(struct hid_bpf_ctx *ctx, enum hid_report_type type, u8 *b
if (ret)
return ret;
- return hid_ops->hid_input_report(ctx->hid, type, buf, size, 0, (u64)(long)ctx, true,
+ return hid_ops->hid_input_report(ctx->hid, type, buf, size, size, 0, (u64)(long)ctx, true,
lock_already_taken);
}
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 294a25330ed0..ceff91722c3c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1998,24 +1998,32 @@ int __hid_request(struct hid_device *hid, struct hid_report *report,
}
EXPORT_SYMBOL_GPL(__hid_request);
-int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
- int interrupt)
+int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data,
+ size_t bufsize, u32 size, int interrupt)
{
struct hid_report_enum *report_enum = hid->report_enum + type;
struct hid_report *report;
struct hid_driver *hdrv;
int max_buffer_size = HID_MAX_BUFFER_SIZE;
u32 rsize, csize = size;
+ size_t bsize = bufsize;
u8 *cdata = data;
int ret = 0;
report = hid_get_report(report_enum, data);
if (!report)
- goto out;
+ return 0;
+
+ if (unlikely(bsize < csize)) {
+ hid_warn_ratelimited(hid, "Event data for report %d is incorrect (%d vs %ld)\n",
+ report->id, csize, bsize);
+ return -EINVAL;
+ }
if (report_enum->numbered) {
cdata++;
csize--;
+ bsize--;
}
rsize = hid_compute_report_size(report);
@@ -2028,9 +2036,15 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
else if (rsize > max_buffer_size)
rsize = max_buffer_size;
+ if (bsize < rsize) {
+ hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %ld)\n",
+ report->id, rsize, bsize);
+ return -EINVAL;
+ }
+
if (csize < rsize) {
dbg_hid("report %d is too short, (%d < %d)\n", report->id,
- csize, rsize);
+ csize, rsize);
memset(cdata + csize, 0, rsize - csize);
}
@@ -2039,7 +2053,7 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
if (hid->claimed & HID_CLAIMED_HIDRAW) {
ret = hidraw_report_event(hid, data, size);
if (ret)
- goto out;
+ return ret;
}
if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
@@ -2051,15 +2065,15 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
if (hid->claimed & HID_CLAIMED_INPUT)
hidinput_report_event(hid, report);
-out:
+
return ret;
}
EXPORT_SYMBOL_GPL(hid_report_raw_event);
static int __hid_input_report(struct hid_device *hid, enum hid_report_type type,
- u8 *data, u32 size, int interrupt, u64 source, bool from_bpf,
- bool lock_already_taken)
+ u8 *data, size_t bufsize, u32 size, int interrupt, u64 source,
+ bool from_bpf, bool lock_already_taken)
{
struct hid_report_enum *report_enum;
struct hid_driver *hdrv;
@@ -2084,7 +2098,8 @@ static int __hid_input_report(struct hid_device *hid, enum hid_report_type type,
report_enum = hid->report_enum + type;
hdrv = hid->driver;
- data = dispatch_hid_bpf_device_event(hid, type, data, &size, interrupt, source, from_bpf);
+ data = dispatch_hid_bpf_device_event(hid, type, data, &bufsize, &size, interrupt,
+ source, from_bpf);
if (IS_ERR(data)) {
ret = PTR_ERR(data);
goto unlock;
@@ -2113,7 +2128,7 @@ static int __hid_input_report(struct hid_device *hid, enum hid_report_type type,
goto unlock;
}
- ret = hid_report_raw_event(hid, type, data, size, interrupt);
+ ret = hid_report_raw_event(hid, type, data, bufsize, size, interrupt);
unlock:
if (!lock_already_taken)
@@ -2135,7 +2150,7 @@ static int __hid_input_report(struct hid_device *hid, enum hid_report_type type,
int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
int interrupt)
{
- return __hid_input_report(hid, type, data, size, interrupt, 0,
+ return __hid_input_report(hid, type, data, size, size, interrupt, 0,
false, /* from_bpf */
false /* lock_already_taken */);
}
diff --git a/drivers/hid/hid-gfrm.c b/drivers/hid/hid-gfrm.c
index 699186ff2349..d2a56bf92b41 100644
--- a/drivers/hid/hid-gfrm.c
+++ b/drivers/hid/hid-gfrm.c
@@ -66,7 +66,7 @@ static int gfrm_raw_event(struct hid_device *hdev, struct hid_report *report,
switch (data[1]) {
case GFRM100_SEARCH_KEY_DOWN:
ret = hid_report_raw_event(hdev, HID_INPUT_REPORT, search_key_dn,
- sizeof(search_key_dn), 1);
+ sizeof(search_key_dn), sizeof(search_key_dn), 1);
break;
case GFRM100_SEARCH_KEY_AUDIO_DATA:
@@ -74,7 +74,7 @@ static int gfrm_raw_event(struct hid_device *hdev, struct hid_report *report,
case GFRM100_SEARCH_KEY_UP:
ret = hid_report_raw_event(hdev, HID_INPUT_REPORT, search_key_up,
- sizeof(search_key_up), 1);
+ sizeof(search_key_up), sizeof(search_key_up), 1);
break;
default:
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index d60cd4379e86..858ac2ab46bd 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -3691,7 +3691,7 @@ static int hidpp10_consumer_keys_raw_event(struct hidpp_device *hidpp,
memcpy(&consumer_report[1], &data[3], 4);
/* We are called from atomic context */
hid_report_raw_event(hidpp->hid_dev, HID_INPUT_REPORT,
- consumer_report, 5, 1);
+ consumer_report, sizeof(consumer_report), 5, 1);
return 1;
}
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index fcf9a806f109..760f9db44c9e 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -500,7 +500,7 @@ static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
}
ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf,
- size, 0);
+ size, size, 0);
if (ret)
dev_warn(&hdev->dev, "failed to report feature\n");
}
diff --git a/drivers/hid/hid-primax.c b/drivers/hid/hid-primax.c
index e44d79dff8de..8db054280afb 100644
--- a/drivers/hid/hid-primax.c
+++ b/drivers/hid/hid-primax.c
@@ -44,7 +44,7 @@ static int px_raw_event(struct hid_device *hid, struct hid_report *report,
data[0] |= (1 << (data[idx] - 0xE0));
data[idx] = 0;
}
- hid_report_raw_event(hid, HID_INPUT_REPORT, data, size, 0);
+ hid_report_raw_event(hid, HID_INPUT_REPORT, data, size, size, 0);
return 1;
default: /* unknown report */
diff --git a/drivers/hid/hid-vivaldi-common.c b/drivers/hid/hid-vivaldi-common.c
index bf734055d4b6..b12bb5cc091a 100644
--- a/drivers/hid/hid-vivaldi-common.c
+++ b/drivers/hid/hid-vivaldi-common.c
@@ -85,7 +85,7 @@ void vivaldi_feature_mapping(struct hid_device *hdev,
}
ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, report_data,
- report_len, 0);
+ report_len, report_len, 0);
if (ret) {
dev_warn(&hdev->dev, "failed to report feature %d\n",
field->report->id);
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 1b1112772777..ffcf65dcf713 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -74,7 +74,7 @@ static void wacom_wac_queue_flush(struct hid_device *hdev,
int err;
size = kfifo_out(fifo, buf, sizeof(buf));
- err = hid_report_raw_event(hdev, HID_INPUT_REPORT, buf, size, false);
+ err = hid_report_raw_event(hdev, HID_INPUT_REPORT, buf, size, size, false);
if (err) {
hid_warn(hdev, "%s: unable to flush event due to error %d\n",
__func__, err);
@@ -319,7 +319,7 @@ static void wacom_feature_mapping(struct hid_device *hdev,
data, n, WAC_CMD_RETRIES);
if (ret == n && features->type == HID_GENERIC) {
ret = hid_report_raw_event(hdev,
- HID_FEATURE_REPORT, data, n, 0);
+ HID_FEATURE_REPORT, data, n, n, 0);
} else if (ret == 2 && features->type != HID_GENERIC) {
features->touch_max = data[1];
} else {
@@ -380,7 +380,7 @@ static void wacom_feature_mapping(struct hid_device *hdev,
data, n, WAC_CMD_RETRIES);
if (ret == n) {
ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT,
- data, n, 0);
+ data, n, n, 0);
} else {
hid_warn(hdev, "%s: could not retrieve sensor offsets\n",
__func__);
diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c
index 63c77a3df591..afa78c96ede8 100644
--- a/drivers/staging/greybus/hid.c
+++ b/drivers/staging/greybus/hid.c
@@ -201,7 +201,7 @@ static void gb_hid_init_report(struct gb_hid *ghid, struct hid_report *report)
* we just need to setup the input fields, so using
* hid_report_raw_event is safe.
*/
- hid_report_raw_event(ghid->hid, report->type, ghid->inbuf, size, 1);
+ hid_report_raw_event(ghid->hid, report->type, ghid->inbuf, ghid->bufsize, size, 1);
}
static void gb_hid_init_reports(struct gb_hid *ghid)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index bef017d6b440..fdd401e4ebde 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -1213,8 +1213,8 @@ static inline u32 hid_report_len(struct hid_report *report)
return DIV_ROUND_UP(report->size, 8) + (report->id > 0);
}
-int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
- int interrupt);
+int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data,
+ size_t bufsize, u32 size, int interrupt);
/* HID quirks API */
unsigned long hid_lookup_quirk(const struct hid_device *hdev);
diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h
index 6a47223e6460..aa87513acbcd 100644
--- a/include/linux/hid_bpf.h
+++ b/include/linux/hid_bpf.h
@@ -72,8 +72,8 @@ struct hid_ops {
int (*hid_hw_output_report)(struct hid_device *hdev, __u8 *buf, size_t len,
u64 source, bool from_bpf);
int (*hid_input_report)(struct hid_device *hid, enum hid_report_type type,
- u8 *data, u32 size, int interrupt, u64 source, bool from_bpf,
- bool lock_already_taken);
+ u8 *data, size_t bufsize, u32 size, int interrupt, u64 source,
+ bool from_bpf, bool lock_already_taken);
struct module *owner;
const struct bus_type *bus_type;
};
@@ -200,7 +200,8 @@ struct hid_bpf {
#ifdef CONFIG_HID_BPF
u8 *dispatch_hid_bpf_device_event(struct hid_device *hid, enum hid_report_type type, u8 *data,
- u32 *size, int interrupt, u64 source, bool from_bpf);
+ size_t *buf_size, u32 *size, int interrupt, u64 source,
+ bool from_bpf);
int dispatch_hid_bpf_raw_requests(struct hid_device *hdev,
unsigned char reportnum, __u8 *buf,
u32 size, enum hid_report_type rtype,
@@ -215,8 +216,11 @@ int hid_bpf_device_init(struct hid_device *hid);
u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, const u8 *rdesc, unsigned int *size);
#else /* CONFIG_HID_BPF */
static inline u8 *dispatch_hid_bpf_device_event(struct hid_device *hid, enum hid_report_type type,
- u8 *data, u32 *size, int interrupt,
- u64 source, bool from_bpf) { return data; }
+ u8 *data, size_t *buf_size, u32 *size,
+ int interrupt, u64 source, bool from_bpf)
+{
+ return data;
+}
static inline int dispatch_hid_bpf_raw_requests(struct hid_device *hdev,
unsigned char reportnum, u8 *buf,
u32 size, enum hid_report_type rtype,
--
2.54.0.823.g6e5bcc1fc9-goog
^ permalink raw reply related
* [linux-6.12.y 1/4] HID: core: Add printk_ratelimited variants to hid_warn() etc
From: Lee Jones @ 2026-06-01 8:36 UTC (permalink / raw)
To: lee, Jiri Kosina, Benjamin Tissoires, Filipe Laíns,
Bastien Nocera, Ping Cheng, Jason Gerecke, Viresh Kumar,
Johan Hovold, Alex Elder, Greg Kroah-Hartman, Sasha Levin,
Mario Limonciello (AMD), Kwok Kin Ming, linux-input, linux-kernel,
linux-usb, greybus-dev, linux-staging, bpf
Cc: stable, Vicki Pfau, Jiri Kosina
From: Vicki Pfau <vi@endrift.com>
hid_warn_ratelimited() is needed. Add the others as part of the block.
Signed-off-by: Vicki Pfau <vi@endrift.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
(cherry picked from commit 1d64624243af8329b4b219d8c39e28ea448f9929)
Signed-off-by: Lee Jones <lee@kernel.org>
---
include/linux/hid.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 7d8d09318fa9..bef017d6b440 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -1245,4 +1245,15 @@ void hid_quirks_exit(__u16 bus);
#define hid_dbg_once(hid, fmt, ...) \
dev_dbg_once(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_err_ratelimited(hid, fmt, ...) \
+ dev_err_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_notice_ratelimited(hid, fmt, ...) \
+ dev_notice_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_warn_ratelimited(hid, fmt, ...) \
+ dev_warn_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_info_ratelimited(hid, fmt, ...) \
+ dev_info_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_dbg_ratelimited(hid, fmt, ...) \
+ dev_dbg_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__)
+
#endif
--
2.54.0.823.g6e5bcc1fc9-goog
^ permalink raw reply related
* Re: [PATCH] staging: fbtft: replace sprintf with snprintf
From: Andy Shevchenko @ 2026-06-01 8:25 UTC (permalink / raw)
To: Enchanted Hunter; +Cc: gregkh, linux-staging, andy, dri-devel
In-Reply-To: <CAOSULec2OpwTGB3OUb_n3CdKO6H_DGJnxw=qsBswbd+JBjemKA@mail.gmail.com>
On Mon, Jun 1, 2026 at 3:44 AM Enchanted Hunter
<enchantedredhunter@gmail.com> wrote:
>
> This patch replaces unsafe sprintf calls with snprintf in
> fbtft_register_framebuffer() to prevent potential buffer overflow.
>
> Signed-off-by: rat1bor <enchantedredhunter@gmail.com>
Does this change address any compiler warning or something like that?
At a glance I do not see any usefulness of this patch except an
unneeded churn.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH 2/4] HID: core: introduce hid_safe_input_report()
From: Benjamin Tissoires @ 2026-06-01 7:30 UTC (permalink / raw)
To: Carlos Llamas
Cc: Benjamin Tissoires, Bastien Nocera, Jiri Kosina,
Filipe Laíns, Ping Cheng, Jason Gerecke, Viresh Kumar,
Johan Hovold, Alex Elder, Greg Kroah-Hartman, Lee Jones,
linux-input, linux-kernel, greybus-dev, linux-staging, linux-usb,
stable
In-Reply-To: <ahsh0UtTX6e0ZeHa@google.com>
Hi Carlos,
On May 30 2026, Carlos Llamas wrote:
> On Thu, Apr 16, 2026 at 04:46:28PM +0200, Benjamin Tissoires wrote:
> > On Thu, Apr 16, 2026 at 11:41 AM Bastien Nocera <hadess@hadess.net> wrote:
> > >
> > > On Wed, 2026-04-15 at 11:38 +0200, Benjamin Tissoires wrote:
> > > > hid_input_report() is used in too many places to have a commit that
> > > > doesn't cross subsystem borders. Instead of changing the API,
> > > > introduce
> > > > a new one when things matters in the transport layers:
> > > > - usbhid
> > > > - i2chid
> > > >
> > > > This effectively revert to the old behavior for those two transport
> > > > layers.
> > > >
> > > > Fixes: 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing
> > > > bogus memset()")
> > > > Cc: stable@vger.kernel.org
> > > > Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> > > > ---
[...]
>
> Hi Benjamin, our CI started failing with commit 0a3fe972a7cb ("HID:
> core: Mitigate potential OOB by removing bogus memset()"), so I was
> hoping your patchset would fix this.
>
> However, I just realized our call path goes through uhid precisely,
> which still triggers the EINVAL error since uhid as not converted to
> hid_safe_input_report().
>
> My vague understanding though, is that uhid_event uses a static buffer
> in ev->data[UHID_DATA_MAX], so maybe we can use that through
> uhid_dev_input{2}()?
>
> I ran the following path through our CI and it fixed our issue, so I
> wanted to get your thoughts on this.
Oh, yes, you are correct. Sorry with all the back and forth on this
paritcular topic, my brain assumed that uhid was only allocating the
useful part of the payload and was not safe.
For the future me: the problem with uhid was that we were emultaing
devices that would trigger a bug elsewhere in the stack not in
uhid_dev_input*().
Patch looks good, please send it normally to the ML with your SoB :)
Cheers,
Benjamin
>
> Carlos Llamas
>
> ---
> drivers/hid/uhid.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
> index 524b53a3c87b..37b60c3aaf66 100644
> --- a/drivers/hid/uhid.c
> +++ b/drivers/hid/uhid.c
> @@ -595,8 +595,8 @@ static int uhid_dev_input(struct uhid_device *uhid, struct uhid_event *ev)
> if (!READ_ONCE(uhid->running))
> return -EINVAL;
>
> - hid_input_report(uhid->hid, HID_INPUT_REPORT, ev->u.input.data,
> - min_t(size_t, ev->u.input.size, UHID_DATA_MAX), 0);
> + hid_safe_input_report(uhid->hid, HID_INPUT_REPORT, ev->u.input.data, UHID_DATA_MAX,
> + min_t(size_t, ev->u.input.size, UHID_DATA_MAX), 0);
>
> return 0;
> }
> @@ -606,8 +606,8 @@ static int uhid_dev_input2(struct uhid_device *uhid, struct uhid_event *ev)
> if (!READ_ONCE(uhid->running))
> return -EINVAL;
>
> - hid_input_report(uhid->hid, HID_INPUT_REPORT, ev->u.input2.data,
> - min_t(size_t, ev->u.input2.size, UHID_DATA_MAX), 0);
> + hid_safe_input_report(uhid->hid, HID_INPUT_REPORT, ev->u.input2.data, UHID_DATA_MAX,
> + min_t(size_t, ev->u.input2.size, UHID_DATA_MAX), 0);
>
> return 0;
> }
>
^ permalink raw reply
* [RFC] drivers/staging/axis-fifo: Looking for users
From: Grewstad @ 2026-06-01 7:15 UTC (permalink / raw)
To: Greg KH
Cc: michal.simek, radhey.shyam.pandey, Andrew Lunn, jic23,
linux-staging, linux-arm-kernel, linux-kernel, jacobsfeder
Hi,
The AXI Stream FIFO driver has been in staging since 2018. I was trying to
understand whether there are real in-tree users of this hardware today, and
what the expected direction for graduating the driver out of staging might be.
The only in tree reference to this driver that i found is
drivers/ethernet/xilinx/xilinx_axienet_main.c, which states:
* TODO:
* - Add Axi Fifo support.
From this, it appears AXI Stream FIFO support may be used for some AXI
Ethernet hardware configurations. However, I’m not sure whether there are
any other in-tree users of the AXI Stream FIFO IP besides Ethernet, or
whether Ethernet is the primary intended consumer.
If there are no other in-tree users, it’s unclear whether this driver should
remain a standalone staging driver or be integrated into a specific subsystem
like networking.
Can you let me know if there are any known in-tree users for this driver,
whether it has a large enough user base to justify its existence in
the kernel tree,
and what the hardware's real use cases are?
Thanks,
Arihan Bhor
^ permalink raw reply
* Re: [RFC] drivers/staging/axis-fifo: TODO file and subsystem direction
From: Grewstad @ 2026-06-01 6:05 UTC (permalink / raw)
To: Andrew Lunn
Cc: gregkh, jic23, jacobsfeder, linux-staging, linux-arm-kernel,
linux-kernel, hjk, davem, netdev
In-Reply-To: <84d8f2a1-6562-47a9-93d7-2d7ff33c31c0@lunn.ch>
On Mon, Jun 1, 2026 at 1:22 AM Andrew Lunn <andrew@lunn.ch> wrote:
>
>
> In addition to what GregKH said, look at the vendor information:
>
> https://docs.amd.com/r/en-US/pg080-axi-fifo-mm-s/Core-Overview
>
> The AXI4-Stream FIFO core was designed to provide memory-mapped
> access to an AXI4-Stream interface connected to other IP (such as
> the AXI Ethernet core). Systems must be built through the AMD
> Vivado™ Design Suite to attach the AXI4-Stream FIFO core, AXI
> Ethernet core ...
>
> when used for Ethernet, a uAPI is not needed. The FIFO driver would
> just expose an kernel internal API the Ethernet driver would use. Are
> there any Ethernet devices using it? Is there a driver for the AXI
> Ethernet core?
As I said to Greg K-H, it's 'chameleon' hardware because we don't know
what it'll be used for. It could be SDR or Ethernet or whatever it is
programmed for. The main thing is that it is a streaming interface.
But we cannot assume the use case.
> Does drivers/net/ethernet/xilinx/* duplicate the same
> code? xilinx_axienet_main.c says:
>
> * TODO:
> * - Add Axi Fifo support.
>
> which could be this.
>
> As GregKH said, find some hardware using these IP cores, or synthesise
> your own, and then work on the driver.
>
> Andrew
Yes, the Axinet driver's TODO suggests adding AXI FIFO support.
Currently, it routes
packets through the AXI DMA engine, but the TODO mentions:
* TODO:
* - Add Axi Fifo support.
* - Factor out Axi DMA code into a separate driver.
This suggests that the AXI FIFO is merely a different configuration of
the axinet
driver, allowing a Xilinx AXI FIFO device to be used for ethernet.
It does not, however, establish how the AXI Stream FIFO IP is intended to be
used outside of the Ethernet context. Since the AXI Stream FIFO is a
general-purpose IP block used in a variety of FPGA designs, it is not yet
clear whether the Ethernet use case fully defines its role in the kernel, or
whether it should be treated as a more general streaming component with
multiple potential consumers.
Thanks,
Arihan Bhor
^ permalink raw reply
* Re: [RFC] drivers/staging/axis-fifo: TODO file and subsystem direction
From: Greg KH @ 2026-06-01 5:53 UTC (permalink / raw)
To: Grewstad
Cc: jic23, jacobsfeder, linux-staging, linux-arm-kernel, linux-kernel,
hjk, davem, netdev
In-Reply-To: <CAD03fjaxcS0rfZbNPNQjg7HxAhhTvOBxH=p-Rj_ngaGBPmpXMA@mail.gmail.com>
On Mon, Jun 01, 2026 at 11:09:36AM +0530, Grewstad wrote:
> I don't have the hardware, but I plan on testing it using QEMU.
I wouldn't recommend this for cleaning up and getting the driver out of
staging, as QEMU might not be working like the real hardware does.
good luck!
greg k-h
^ permalink raw reply
* Re: [PATCH] staging: fbtft: replace sprintf with snprintf
From: Greg KH @ 2026-06-01 5:44 UTC (permalink / raw)
To: Enchanted Hunter; +Cc: linux-staging, andy, dri-devel
In-Reply-To: <CAOSULec2OpwTGB3OUb_n3CdKO6H_DGJnxw=qsBswbd+JBjemKA@mail.gmail.com>
On Mon, Jun 01, 2026 at 03:43:55AM +0300, Enchanted Hunter wrote:
> This patch replaces unsafe sprintf calls with snprintf
> infbtft_register_framebuffer() to prevent potential buffer
> overflow.Signed-off-by: rat1bor <enchantedredhunter@gmail.com>
> From a79c6098f2e8bb2ee9e276d339710522175db977 Mon Sep 17 00:00:00 2001
> From: rat1bor <enchantedredhunter@gmail.com>
> Date: Mon, 1 Jun 2026 03:18:59 +0300
> Subject: [PATCH] staging: fbtft: replace sprintf with snprintf
>
> Signed-off-by: rat1bor <enchantedredhunter@gmail.com>
> ---
> drivers/staging/fbtft/fbtft-core.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> index ca0c38221c16..66509347255a 100644
> --- a/drivers/staging/fbtft/fbtft-core.c
> +++ b/drivers/staging/fbtft/fbtft-core.c
> @@ -784,10 +784,11 @@ int fbtft_register_framebuffer(struct fb_info *fb_info)
> fbtft_sysfs_init(par);
>
> if (par->txbuf.buf && par->txbuf.len >= 1024)
> - sprintf(text1, ", %zu KiB buffer memory", par->txbuf.len >> 10);
> + snprintf(text1, sizeof(text1), ", %zu KiB buffer memory", par->txbuf.len >> 10);
> if (spi)
> - sprintf(text2, ", spi%d.%d at %d MHz", spi->controller->bus_num,
> - spi_get_chipselect(spi, 0), spi->max_speed_hz / 1000000);
> + snprintf(text2, sizeof(text2), ", spi%d.%d at %d MHz",
> + spi->controller->bus_num, spi_get_chipselect(spi, 0),
> + spi->max_speed_hz / 1000000);
> fb_dbg(fb_info,
> "%s frame buffer, %dx%d, %d KiB video memory%s, fps=%lu%s\n",
> fb_info->fix.id, fb_info->var.xres, fb_info->var.yres,
> --
> 2.34.1
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- Your patch was attached, please place it inline so that it can be
applied directly from the email message itself.
- You did not specify a description of why the patch is needed, or
possibly, any description at all, in the email body. Please read the
section entitled "The canonical patch format" in the kernel file,
Documentation/process/submitting-patches.rst for what is needed in
order to properly describe the change.
- You did not write a descriptive Subject: for the patch, allowing Greg,
and everyone else, to know what this patch is all about. Please read
the section entitled "The canonical patch format" in the kernel file,
Documentation/process/submitting-patches.rst for what a proper
Subject: line should look like.
- It looks like you did not use your "real" name for the patch on either
the Signed-off-by: line, or the From: line (both of which have to
match). Please read the kernel file,
Documentation/process/submitting-patches.rst for how to do this
correctly.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox