* [QUESTION] staging: octeon: is the FIXME in cvm_oct_sgmii_init stale?
From: Pablo D. Bergamasco @ 2026-06-17 21:07 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, danpablo
Hi Greg,
While looking at drivers/staging/octeon/ethernet-sgmii.c I noticed
a FIXME comment in cvm_oct_sgmii_init():
cvm_oct_common_init(dev);
/* FIXME: Need autoneg logic */
return 0;
After tracing the code, I believe autoneg is already handled when
the interface is opened:
cvm_oct_sgmii_open()
-> cvm_oct_common_open()
-> cvm_oct_phy_setup_device()
-> phy_start()
-> phy_state_machine()
-> _phy_start_aneg()
-> genphy_config_aneg()
Is my analysis correct? If so, should I send a patch to remove
the stale FIXME comment?
Thanks,
Pablo D. Bergamasco
^ permalink raw reply
* Re: [PATCH v3] media: atomisp: replace kmalloc() with kmalloc_objs() in sh_css.c
From: Andrei Khomenkov @ 2026-06-17 15:10 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Dan Carpenter, Greg Kroah-Hartman, linux-media, linux-staging
In-Reply-To: <ajEtHT5PXYZYXUX8@ashevche-desk.local>
Thanks Andy, thanks Dan
I saw that a similar patch (commit 11f94f5b1d30) was already submitted by
Pedro Pontes, so my patch is no longer relevant.
I ran the command
scripts/get_maintainer.pl --scm -f drivers/staging/media/atomisp/pci/sh_css.c
and saw that when working with this driver, patches should be submitted
to the git.linuxtv.org/media.git repository, not to Greg's staging tree.
It's also clear now that working against the linux-next tree is a better
option.
Andrei
^ permalink raw reply
* Re: [PATCH v4] staging: rtl8723bs: remove redundant rsp_allocated_buf
From: Dan Carpenter @ 2026-06-17 13:21 UTC (permalink / raw)
To: Devansh Soni; +Cc: gregkh, linux-staging, linux-kernel
In-Reply-To: <20260617123853.63022-1-devanshsoni874@gmail.com>
On Wed, Jun 17, 2026 at 06:08:53PM +0530, Devansh Soni wrote:
> The original code allocated extra memory and manually aligned the
> rsp_buf pointer to a 4-byte boundary, however kzalloc() guarantees a
> minimum of 8-byte alignment so this was unnecessary.
>
> Also, because the pointer was shifted, the original pointer had to be
> stored in rsp_allocated_buf just so it could be passed to kfree() later.
>
> Remove the redundant alignment math, remove the extra 4 bytes of padding
> from kzalloc() call, and assign memory directly to rsp_buf.
>
> This allows us to remove the rsp_allocated_buf variable from cmd_priv
> struct.
>
> Suggested-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Devansh Soni <devanshsoni874@gmail.com>
> ---
> Changes in v4:
> - Dropped PTR_ALIGN() entirely as kzalloc() 8-byte alignment is sufficient.
> - Removed the +4 byte padding from kzalloc().
> - Completely removed the rsp_allocated_buf tracking variable and updated kfree().
Thanks!
Reviewed-by: Dan Carpenter <error27@gmail.com>
regards,
dan carpenter
^ permalink raw reply
* [PATCH v4] staging: rtl8723bs: remove redundant rsp_allocated_buf
From: Devansh Soni @ 2026-06-17 12:38 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, Devansh Soni, Dan Carpenter
The original code allocated extra memory and manually aligned the
rsp_buf pointer to a 4-byte boundary, however kzalloc() guarantees a
minimum of 8-byte alignment so this was unnecessary.
Also, because the pointer was shifted, the original pointer had to be
stored in rsp_allocated_buf just so it could be passed to kfree() later.
Remove the redundant alignment math, remove the extra 4 bytes of padding
from kzalloc() call, and assign memory directly to rsp_buf.
This allows us to remove the rsp_allocated_buf variable from cmd_priv
struct.
Suggested-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Devansh Soni <devanshsoni874@gmail.com>
---
Changes in v4:
- Dropped PTR_ALIGN() entirely as kzalloc() 8-byte alignment is sufficient.
- Removed the +4 byte padding from kzalloc().
- Completely removed the rsp_allocated_buf tracking variable and updated kfree().
Changes in v3:
- Replaced manual bitwise math with PTR_ALIGN() macro based on feedback from v1.
- Updated commit message to detail kzalloc() 8-byte alignment guarantees.
Changes in v2:
- Wrapped commit log text to resolve line length issue noted by Greg.
drivers/staging/rtl8723bs/core/rtw_cmd.c | 9 +++------
drivers/staging/rtl8723bs/include/rtw_cmd.h | 1 -
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index b932670f5..fd1ba1b4e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -178,15 +178,12 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
pcmdpriv->cmd_buf = PTR_ALIGN(pcmdpriv->cmd_allocated_buf, CMDBUFF_ALIGN_SZ);
- pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_ATOMIC);
- if (!pcmdpriv->rsp_allocated_buf) {
+ pcmdpriv->rsp_buf = kzalloc(MAX_RSPSZ, GFP_ATOMIC);
+ if (!pcmdpriv->rsp_buf) {
kfree(pcmdpriv->cmd_allocated_buf);
return -ENOMEM;
}
- pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 -
- ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3);
-
pcmdpriv->cmd_issued_cnt = 0;
pcmdpriv->cmd_done_cnt = 0;
pcmdpriv->rsp_cnt = 0;
@@ -232,7 +229,7 @@ void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv)
if (pcmdpriv) {
kfree(pcmdpriv->cmd_allocated_buf);
- kfree(pcmdpriv->rsp_allocated_buf);
+ kfree(pcmdpriv->rsp_buf);
mutex_destroy(&pcmdpriv->sctx_mutex);
}
diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h b/drivers/staging/rtl8723bs/include/rtw_cmd.h
index f78aa0d7a..66b970955 100644
--- a/drivers/staging/rtl8723bs/include/rtw_cmd.h
+++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h
@@ -45,7 +45,6 @@
u8 *cmd_buf; /* shall be non-paged, and 4 bytes aligned */
u8 *cmd_allocated_buf;
u8 *rsp_buf; /* shall be non-paged, and 4 bytes aligned */
- u8 *rsp_allocated_buf;
u32 cmd_issued_cnt;
u32 cmd_done_cnt;
u32 rsp_cnt;
--
2.54.0
^ permalink raw reply related
* [PATCH v3 4/4] staging: rtl8723bs: convert update_attrib to return errno
From: Hungyu Lin @ 2026-06-17 12:16 UTC (permalink / raw)
To: gregkh; +Cc: error27, linux-staging, linux-kernel, Hungyu Lin
Convert update_attrib() to return 0 on success and a
negative errno on failure. Update rtw_xmit() to handle
the returned error code.
No functional change intended.
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_xmit.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 066f6e974e4e..4d886a35f4c8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -654,7 +654,7 @@ static int set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
return 0;
}
-static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pkt_attrib *pattrib)
+static int update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pkt_attrib *pattrib)
{
struct pkt_file pktfile;
struct sta_info *psta = NULL;
@@ -741,24 +741,24 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
} else {
psta = rtw_get_stainfo(pstapriv, pattrib->ra);
if (!psta) /* if we cannot get psta => drop the pkt */
- return _FAIL;
+ return -EINVAL;
else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) && !(psta->state & _FW_LINKED))
- return _FAIL;
+ return -EINVAL;
}
if (!psta) {
/* if we cannot get psta => drop the pkt */
- return _FAIL;
+ return -EINVAL;
}
if (!(psta->state & _FW_LINKED))
- return _FAIL;
+ return -EINVAL;
spin_lock_bh(&psta->lock);
ret = update_attrib_sec_info(padapter, pattrib, psta);
if (ret) {
spin_unlock_bh(&psta->lock);
- return _FAIL;
+ return ret;
}
update_attrib_phy_info(padapter, pattrib, psta);
@@ -794,7 +794,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
}
/* pattrib->priority = 5; force to used VI queue, for testing */
- return _SUCCESS;
+ return 0;
}
static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitframe)
@@ -1955,7 +1955,7 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt)
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct xmit_frame *pxmitframe = NULL;
- s32 res;
+ int ret;
if (start == 0)
start = jiffies;
@@ -1968,9 +1968,8 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt)
if (!pxmitframe)
return -1;
- res = update_attrib(padapter, *ppkt, &pxmitframe->attrib);
-
- if (res != _SUCCESS) {
+ ret = update_attrib(padapter, *ppkt, &pxmitframe->attrib);
+ if (ret) {
rtw_free_xmitframe(pxmitpriv, pxmitframe);
return -1;
}
--
2.34.1
^ permalink raw reply related
* Re: [PATCH v3 0/4] staging: rtl8723bs: convert update_attrib path to errno
From: Hungyu Lin @ 2026-06-17 12:09 UTC (permalink / raw)
To: Dan Carpenter; +Cc: gregkh, linux-staging, linux-kernel
In-Reply-To: <ajKKynn13sv-_UZl@stanley.mountain>
On Wed, Jun 17, 2026 at 4:53 AM Dan Carpenter <error27@gmail.com> wrote:
>
> The first three patches are fine. Where is patch 4?
Looks like patch 4/4 was blocked by Gmail and never made it through.
I'll resend it separately.
Thanks,
Hungyu
^ permalink raw reply
* Re: [PATCH v2 2/2] staging: rtl8723bs: Fix comment style issues in header files
From: Dan Carpenter @ 2026-06-17 11:54 UTC (permalink / raw)
To: Subhrojyoti Bala; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel
In-Reply-To: <20260617064150.16078-3-subhrojyoti0609@gmail.com>
On Wed, Jun 17, 2026 at 12:11:50PM +0530, Subhrojyoti Bala wrote:
> Fix various comment style issues in wlan_bssdef.h and rtw_mlme.h
> to comply with kernel coding style:
>
> - Use proper multi-line comment format with trailing */ on its
> own line
> - Remove extra spaces after /* in single-line comments
>
> No functional change.
>
> Signed-off-by: Subhrojyoti Bala <subhrojyoti0609@gmail.com>
> ---
> v2: Combined four separate comment style patches from v1 into
> this single patch per Dan Carpenter's feedback.
LGTM.
Reviewed-by: Dan Carpenter <error27@gmail.com>
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH v3 0/4] staging: rtl8723bs: convert update_attrib path to errno
From: Dan Carpenter @ 2026-06-17 11:53 UTC (permalink / raw)
To: Hungyu Lin; +Cc: gregkh, linux-staging, linux-kernel
In-Reply-To: <20260616235241.99076-1-dennylin0707@gmail.com>
The first three patches are fine. Where is patch 4?
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH] staging: rtl8723bs: replace beacon timing magic numbers
From: Dan Carpenter @ 2026-06-17 11:52 UTC (permalink / raw)
To: Jad Keskes; +Cc: Greg Kroah-Hartman, Dan Carpenter, linux-staging
In-Reply-To: <20260616193134.1759947-1-inasj268@gmail.com>
On Tue, Jun 16, 2026 at 08:31:34PM +0100, Jad Keskes wrote:
> Break down the 0x6404 and 0x660F in
> rtl8723b_InitBeaconParameters() so people don't need the out-of-tree
> driver open to know what these do.
>
> REG_TBTT_PROHIBIT (0x0540): 0x6404 = hold (0x64) and setup (0x04), both
> in 32us ticks. Same layout as rtw88.
>
> REG_BCNTCFG (0x0510): 0x660F is an EDCA-like register. Lower byte is
> AIFS (0x0F = no contention before beacon), next nibble is CWmin (0x06),
> top nibble is CWmax (0x06). Matches rtl8192cu which writes 0x66FF
> (test chips) and 0x660F (production).
>
> Drop the TODO since this was the last thing it referenced.
>
> Signed-off-by: Jad Keskes <inasj268@gmail.com>
>
> Link: https://lore.kernel.org/all/aiGMXBNQ0TbIGbpP@stanley.mountain/
> ---
Seems reasonable.
Reviewed-by: Dan Carpenter <error27@gmail.com>
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH v3 1/2] media: atomisp: fix memory leak in atomisp_pci_probe()
From: Andy Shevchenko @ 2026-06-17 9:40 UTC (permalink / raw)
To: Dawei Feng
Cc: andy, error27, hansg, mchehab, sakari.ailus, gregkh,
abdelrahmanfekry375, linux-kernel, linux-media, linux-staging,
jianhao.xu, Zilin Guan
In-Reply-To: <20260616134319.3969928-2-dawei.feng@seu.edu.cn>
On Tue, Jun 16, 2026 at 09:43:18PM +0800, Dawei Feng wrote:
> atomisp_initialize_modules() creates CSI2 and ISP subdev media entities
> before atomisp_pci_probe() registers them. Its counterpart,
> atomisp_uninitialize_modules(), only releases part of that module-owned
> state and leaves some media entity cleanup to the entity unregister path.
>
> That ownership split is incomplete for probe error paths. If
> atomisp_pci_probe() fails after module initialization but before all
> entities are registered, the unwind path cannot rely on unregister
> helpers to release media entity state whose lifetime started in module
> initialization. The CSI2 and ISP subdev media entities can therefore be
> left allocated.
>
> Refactor the cleanup boundary so module cleanup releases media entities
> created by module initialization, while unregister helpers only undo
> registered V4L2 and media device state. Move CSI2 and ISP subdev media
> entity cleanup into atomisp_mipi_csi2_cleanup() and the new
> atomisp_subdev_cleanup(), and run media_device_cleanup() after module
> cleanup in the probe unwind and remove paths.
>
> If atomisp_mipi_csi2_init() itself fails, it has already unwound its
> partial setup, so return the error directly. Only the later
> atomisp_subdev_init() failure path needs to clean up CSI2 from the
> caller.
...
> void atomisp_mipi_csi2_cleanup(struct atomisp_device *isp)
> {
> + unsigned int i;
> +
> + for (i = 0; i < ATOMISP_CAMERA_NR_PORTS; i++)
In case you need a new version
for (unsigned int i = 0; i < ATOMISP_CAMERA_NR_PORTS; i++)
> + media_entity_cleanup(&isp->csi2_port[i].subdev.entity);
> }
Or maybe Sakari can tweak this whilst applying.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v2] media: meson: vdec: fix use-after-free of decode work in stop/close path
From: Doruk Tan Ozturk @ 2026-06-17 7:41 UTC (permalink / raw)
To: neil.armstrong
Cc: mchehab, gregkh, hverkuil, jbrunet, martin.blumenstingl,
linux-media, linux-amlogic, linux-staging, linux-arm-kernel,
linux-kernel, Doruk Tan Ozturk
In-Reply-To: <20260616074952.93076-1-doruk@0sec.ai>
Please drop v1 and v2 -- both are wrong, and the sashiko review was right
about the deadlock.
The underlying bug is real: vdec_close() does kfree(sess) (and
v4l2_m2m_ctx_release() frees sess->m2m_ctx) without cancelling
sess->esparser_queue_work, whose worker dereferences sess->lock and
sess->m2m_ctx -> UAF if it is pending/running at teardown.
But cancelling on the streamoff/poweroff path can't work:
1) Deadlock. The worker takes sess->lock. For an m2m fh the ioctl core
takes m2m_ctx->q_lock (== sess->lock) for VIDIOC_STREAMOFF and holds it
across the handler, so vdec_stop_streaming() -> vdec_poweroff() already
runs under sess->lock; cancel_work_sync() there waits on a worker blocked
on that same lock.
2) Use-after-power-down. v2 also cancelled after vdec_ops->stop(), which
power-gates VDEC1 (__vdec_1_stop()), while the worker still reads a VDEC1
register (vdec_1_vififo_level() -> VLD_MEM_VIFIFO_LEVEL).
The only deadlock-free point I see is vdec_close() (the ->release fop, not
under sess->lock), cancelling before v4l2_m2m_ctx_release() -- but that
still leaves the threaded VDEC ISR (amvdec_dst_buf_done() ->
schedule_work()) able to re-arm the worker, and there are adjacent teardown
issues (esparser_isr() vs the dos_parser_clk disable;
vdec_decoder_cmd()/esparser_queue_eos() without sess->lock).
I don't have Meson hardware to validate a corrected fix. Is a
vdec_close()-only cancel (plus quiescing the VDEC IRQ outside sess->lock)
the direction you'd want, or would you rather take it given the HW testing
and the surrounding teardown concerns?
Doruk
^ permalink raw reply
* Re: [PATCH] staging: greybus: power_supply: remove unnecessary parentheses in return
From: Rui Miguel Silva @ 2026-06-17 7:22 UTC (permalink / raw)
To: Tomasz Unger, Rui Miguel Silva, Johan Hovold, Alex Elder,
Greg Kroah-Hartman
Cc: greybus-dev, linux-staging, linux-kernel
In-Reply-To: <20260615-greybus-power-supply-return-parens-v1-1-dcad9dabfe79@yahoo.pl>
Hi Tomasz,
Thanks for the patch.
On Mon Jun 15, 2026 at 1:13 PM WEST, Tomasz Unger wrote:
> return is not a function, so the parentheses around the returned
> expressions are not needed. Remove them to follow kernel coding
> style and silence checkpatch.pl RETURN_PARENTHESES warnings.
>
> Verified with checkpatch.pl - no errors or warnings.
> Compiled the power_supply object successfully.
>
> Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
LGTM,
Acked-by: Rui Miguel Silva <rui.silva@linaro.org>
Cheers,
Rui
> ---
> drivers/staging/greybus/power_supply.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c
> index 33b7a63979d6..44bd8a72fa50 100644
> --- a/drivers/staging/greybus/power_supply.c
> +++ b/drivers/staging/greybus/power_supply.c
> @@ -336,7 +336,7 @@ static int is_psy_prop_writeable(struct gb_power_supply *gbpsy,
>
> static int is_prop_valint(enum power_supply_property psp)
> {
> - return ((psp < POWER_SUPPLY_PROP_MODEL_NAME) ? 1 : 0);
> + return (psp < POWER_SUPPLY_PROP_MODEL_NAME) ? 1 : 0;
> }
>
> static void next_interval(struct gb_power_supply *gbpsy)
> @@ -423,7 +423,7 @@ static void check_changed(struct gb_power_supply *gbpsy,
> static int total_props(struct gb_power_supply *gbpsy)
> {
> /* this return the intval plus the strval properties */
> - return (gbpsy->properties_count + gbpsy->properties_count_str);
> + return gbpsy->properties_count + gbpsy->properties_count_str;
> }
>
> static void prop_append(struct gb_power_supply *gbpsy,
>
> ---
> base-commit: 7cb1c5b32a2bfde961fff8d5204526b609bcb30a
> change-id: 20260615-greybus-power-supply-return-parens-b3dd9f4a87c7
>
> Best regards,
> --
> Tomasz Unger <tomasz.unger@yahoo.pl>
^ permalink raw reply
* [PATCH v2 2/2] staging: rtl8723bs: Fix comment style issues in header files
From: Subhrojyoti Bala @ 2026-06-17 6:41 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Dan Carpenter, linux-staging, linux-kernel, Subhrojyoti Bala
In-Reply-To: <20260617064150.16078-1-subhrojyoti0609@gmail.com>
Fix various comment style issues in wlan_bssdef.h and rtw_mlme.h
to comply with kernel coding style:
- Use proper multi-line comment format with trailing */ on its
own line
- Remove extra spaces after /* in single-line comments
No functional change.
Signed-off-by: Subhrojyoti Bala <subhrojyoti0609@gmail.com>
---
v2: Combined four separate comment style patches from v1 into
this single patch per Dan Carpenter's feedback.
drivers/staging/rtl8723bs/include/rtw_mlme.h | 44 +++++++++----------
.../staging/rtl8723bs/include/wlan_bssdef.h | 13 +++---
2 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index 403c097b46ef..950761d4740c 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -13,8 +13,8 @@
/* define MAX_JOIN_TIMEOUT 2500 */
#define MAX_JOIN_TIMEOUT 6500
-/* Commented by Albert 20101105 */
-/* Increase the scanning timeout because of increasing the SURVEY_TO value. */
+/* Commented by Albert 20101105 */
+/* Increase the scanning timeout because of increasing the SURVEY_TO value. */
#define SCANNING_TIMEOUT 8000
@@ -52,7 +52,7 @@ enum {
dot11AuthAlgrthm_MaxNum
};
-/* Scan type including active and passive scan. */
+/* Scan type including active and passive scan. */
enum rt_scan_type {
SCAN_PASSIVE,
SCAN_ACTIVE,
@@ -67,23 +67,22 @@ enum {
};
/*
-
-there are several "locks" in mlme_priv,
-since mlme_priv is a shared resource between many threads,
-like ISR/Call-Back functions, the OID handlers, and even timer functions.
-
-Each struct __queue has its own locks, already.
-Other items in mlme_priv are protected by mlme_priv.lock, while items in
-xmit_priv are protected by xmit_priv.lock.
-
-To avoid possible dead lock, any thread trying to modifying mlme_priv
-SHALL not lock up more than one locks at a time!
-
-The only exception is that queue functions which take the __queue.lock
-may be called with the xmit_priv.lock held. In this case the order
-MUST always be first lock xmit_priv.lock and then call any queue functions
-which take __queue.lock.
-*/
+ * There are several "locks" in mlme_priv,
+ * since mlme_priv is a shared resource between many threads,
+ * like ISR/Call-Back functions, the OID handlers, and even timer functions.
+ *
+ * Each struct __queue has its own locks, already.
+ * Other items in mlme_priv are protected by mlme_priv.lock, while items in
+ * xmit_priv are protected by xmit_priv.lock.
+ *
+ * To avoid possible dead lock, any thread trying to modifying mlme_priv
+ * SHALL not lock up more than one locks at a time!
+ *
+ * The only exception is that queue functions which take the __queue.lock
+ * may be called with the xmit_priv.lock held. In this case the order
+ * MUST always be first lock xmit_priv.lock and then call any queue functions
+ * which take __queue.lock.
+ */
struct sitesurvey_ctrl {
u64 last_tx_pkts;
@@ -184,7 +183,8 @@ struct mlme_priv {
u32 wps_probe_req_ie_len;
/* Number of associated Non-ERP stations (i.e., stations using 802.11b
- * in 802.11g BSS) */
+ * in 802.11g BSS)
+ */
int num_sta_non_erp;
/* Number of associated stations that do not support Short Slot Time */
@@ -279,7 +279,7 @@ extern signed int rtw_set_auth(struct adapter *adapter, struct security_priv *ps
static inline u8 *get_bssid(struct mlme_priv *pmlmepriv)
{ /* if sta_mode:pmlmepriv->cur_network.network.mac_address => bssid */
- /* if adhoc_mode:pmlmepriv->cur_network.network.mac_address => ibss mac address */
+ /* if adhoc_mode:pmlmepriv->cur_network.network.mac_address => ibss mac address */
return pmlmepriv->cur_network.network.mac_address;
}
diff --git a/drivers/staging/rtl8723bs/include/wlan_bssdef.h b/drivers/staging/rtl8723bs/include/wlan_bssdef.h
index 812a68394268..26d166f087df 100644
--- a/drivers/staging/rtl8723bs/include/wlan_bssdef.h
+++ b/drivers/staging/rtl8723bs/include/wlan_bssdef.h
@@ -32,9 +32,9 @@ enum ndis_802_11_network_type {
};
/*
- FW will only save the channel number in DSConfig.
- ODI Handler will convert the channel number to freq. number.
-*/
+ * FW will only save the channel number in DSConfig.
+ * ODI Handler will convert the channel number to freq. number.
+ */
struct ndis_802_11_conf {
u32 length; /* Length of structure */
u32 beacon_period; /* units are Kusec */
@@ -138,7 +138,8 @@ struct wlan_phy_info {
struct wlan_bcn_info {
/* these infor get from rtw_get_encrypt_info when
- * * translate scan to UI */
+ * translate scan to UI
+ */
u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
int group_cipher; /* WPA/WPA2 group cipher */
int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
@@ -150,8 +151,8 @@ struct wlan_bcn_info {
};
/* temporally add #pragma pack for structure alignment issue of
-* struct wlan_bssid_ex and get_wlan_bssid_ex_sz()
-*/
+ * struct wlan_bssid_ex and get_wlan_bssid_ex_sz()
+ */
struct wlan_bssid_ex {
u32 length;
u8 mac_address[ETH_ALEN];
--
2.54.0
^ permalink raw reply related
* [PATCH v2 1/2] staging: rtl8723bs: Fix indentation in enum in rtw_mlme.h
From: Subhrojyoti Bala @ 2026-06-17 6:41 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Dan Carpenter, linux-staging, linux-kernel, Subhrojyoti Bala
In-Reply-To: <20260617064150.16078-1-subhrojyoti0609@gmail.com>
Enum members were missing tab indentation. Add proper tab
indent to align with kernel coding style.
No functional change.
Signed-off-by: Subhrojyoti Bala <subhrojyoti0609@gmail.com>
---
v2: No changes to this patch.
drivers/staging/rtl8723bs/include/rtw_mlme.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index ac3ba746b64c..403c097b46ef 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -44,12 +44,12 @@
enum {
- dot11AuthAlgrthm_Open = 0,
- dot11AuthAlgrthm_Shared,
- dot11AuthAlgrthm_8021X,
- dot11AuthAlgrthm_Auto,
- dot11AuthAlgrthm_WAPI,
- dot11AuthAlgrthm_MaxNum
+ dot11AuthAlgrthm_Open = 0,
+ dot11AuthAlgrthm_Shared,
+ dot11AuthAlgrthm_8021X,
+ dot11AuthAlgrthm_Auto,
+ dot11AuthAlgrthm_WAPI,
+ dot11AuthAlgrthm_MaxNum
};
/* Scan type including active and passive scan. */
--
2.54.0
^ permalink raw reply related
* [PATCH v2 0/2] staging: rtl8723bs: Fix coding style issues in header files
From: Subhrojyoti Bala @ 2026-06-17 6:41 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Dan Carpenter, linux-staging, linux-kernel, Subhrojyoti Bala
This patch series fixes coding style issues in the rtl8723bs
staging driver header files, as reported by checkpatch.pl.
v2: Combined the four comment style patches into a single patch
per Dan Carpenter's feedback. Kept the enum indentation fix
separate as requested.
Signed-off-by: Subhrojyoti Bala <subhrojyoti0609@gmail.com>
Subhrojyoti Bala (2):
staging: rtl8723bs: Fix indentation in enum in rtw_mlme.h
staging: rtl8723bs: Fix comment style issues in header files
drivers/staging/rtl8723bs/include/rtw_mlme.h | 56 +++++++++----------
.../staging/rtl8723bs/include/wlan_bssdef.h | 13 +++--
2 files changed, 35 insertions(+), 34 deletions(-)
--
2.54.0
^ permalink raw reply
* Re: [PATCH v3] staging: sm750fb: rename pv_reg to io_base
From: neha arora @ 2026-06-17 3:00 UTC (permalink / raw)
To: Dan Carpenter
Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
linux-kernel
In-Reply-To: <ai-j96dVwtPMERVM@stanley.mountain>
Hi Dan,
Please disregard my previous patch submission.
I am currently working on a complete rewrite of the sm750fb staging
driver into a modern, KMS-based DRM driver (sm750drm). Because this
is a complete architectural overhaul, I am building it outside the
staging tree structure.
Once the sm750drm driver framework is stable and ready for a RFC
(Request for Comments), I will submit the entire new subsystem patch series
directly to the dri-devel mailing list and CC you.
Thank you for your review and your time!
Regards,
Onish
On Mon, Jun 15, 2026 at 12:34 PM Dan Carpenter <error27@gmail.com> wrote:
>
> On Sun, Jun 14, 2026 at 12:45:05AM +0530, neha arora wrote:
> > Hi everyone,
> >
> > Just following up on this patch to ensure it didn't get lost in the queue.
> > Please let me know if any changes or a V4 are needed.
> >
>
> It doesn't apply to linux-next. Did you work against the lastest
> devel-next tree?
>
> regards,
> dan carpenter
>
^ permalink raw reply
* Re: [PATCH] staging: greybus: uart: replace IDR with XArray
From: Greg KH @ 2026-06-17 1:26 UTC (permalink / raw)
To: Jack Lee; +Cc: dtwlin, johan, elder, greybus-dev, linux-staging, linux-kernel
In-Reply-To: <20260616190703.28411-1-skunkolee@gmail.com>
On Tue, Jun 16, 2026 at 12:07:03PM -0700, Jack Lee wrote:
> DEFINE_IDR is deprecated in favor of XArray. Convert tty_minors
> from IDR to XArray, replacing idr_alloc, idr_find, idr_remove and
> idr_destroy with their xa_alloc, xa_load, xa_erase and xa_destroy
> equivalents.
>
> Signed-off-by: Jack Lee <skunkolee@gmail.com>
> ---
> drivers/staging/greybus/uart.c | 23 +++++++++++------------
> 1 file changed, 11 insertions(+), 12 deletions(-)
>
This "cleanup" has come up in the past, and shot down each time as it's
not really needed or necessary. idr is just fine to use here and xarray
is overkill.
thanks,
greg k-h
^ permalink raw reply
* [PATCH v3 3/4] staging: rtl8723bs: convert update_attrib_sec_info to return errno
From: Hungyu Lin @ 2026-06-16 23:52 UTC (permalink / raw)
To: gregkh; +Cc: error27, linux-staging, linux-kernel, Hungyu Lin
In-Reply-To: <20260616235241.99076-1-dennylin0707@gmail.com>
Convert update_attrib_sec_info() to return 0 on success and
a negative errno on failure.
No functional change intended.
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_xmit.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 69b6d3a2554a..066f6e974e4e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -505,7 +505,7 @@ static void update_attrib_phy_info(struct adapter *padapter, struct pkt_attrib *
pattrib->retry_ctrl = false;
}
-static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta)
+static int update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct security_priv *psecuritypriv = &padapter->securitypriv;
@@ -519,7 +519,7 @@ static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *p
pattrib->encrypt = 0;
if ((pattrib->ether_type != 0x888e) && !check_fwstate(pmlmepriv, WIFI_MP_STATE))
- return _FAIL;
+ return -EINVAL;
} else {
GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast);
@@ -558,7 +558,7 @@ static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *p
pattrib->icv_len = 4;
if (psecuritypriv->busetkipkey == _FAIL)
- return _FAIL;
+ return -EINVAL;
if (bmcast)
TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx);
@@ -596,7 +596,7 @@ static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *p
else
pattrib->bswenc = false;
- return _SUCCESS;
+ return 0;
}
u8 qos_acm(u8 acm_mask, u8 priority)
@@ -755,7 +755,8 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
return _FAIL;
spin_lock_bh(&psta->lock);
- if (update_attrib_sec_info(padapter, pattrib, psta) == _FAIL) {
+ ret = update_attrib_sec_info(padapter, pattrib, psta);
+ if (ret) {
spin_unlock_bh(&psta->lock);
return _FAIL;
}
--
2.34.1
^ permalink raw reply related
* [PATCH v3 2/4] staging: rtl8723bs: simplify update_attrib control flow
From: Hungyu Lin @ 2026-06-16 23:52 UTC (permalink / raw)
To: gregkh; +Cc: error27, linux-staging, linux-kernel, Hungyu Lin
In-Reply-To: <20260616235241.99076-1-dennylin0707@gmail.com>
Replace goto-based error handling with direct returns and
remove the temporary res variable.
No functional change.
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_xmit.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 6ab91de472b0..69b6d3a2554a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -664,7 +664,6 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct qos_priv *pqospriv = &pmlmepriv->qospriv;
- signed int res = _SUCCESS;
int ret;
_rtw_open_pktfile(pkt, &pktfile);
@@ -741,19 +740,15 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
psta = rtw_get_bcmc_stainfo(padapter);
} else {
psta = rtw_get_stainfo(pstapriv, pattrib->ra);
- if (!psta) { /* if we cannot get psta => drop the pkt */
- res = _FAIL;
- goto exit;
- } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) && !(psta->state & _FW_LINKED)) {
- res = _FAIL;
- goto exit;
- }
+ if (!psta) /* if we cannot get psta => drop the pkt */
+ return _FAIL;
+ else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) && !(psta->state & _FW_LINKED))
+ return _FAIL;
}
if (!psta) {
/* if we cannot get psta => drop the pkt */
- res = _FAIL;
- goto exit;
+ return _FAIL;
}
if (!(psta->state & _FW_LINKED))
@@ -762,8 +757,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
spin_lock_bh(&psta->lock);
if (update_attrib_sec_info(padapter, pattrib, psta) == _FAIL) {
spin_unlock_bh(&psta->lock);
- res = _FAIL;
- goto exit;
+ return _FAIL;
}
update_attrib_phy_info(padapter, pattrib, psta);
@@ -799,9 +793,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
}
/* pattrib->priority = 5; force to used VI queue, for testing */
-
-exit:
- return res;
+ return _SUCCESS;
}
static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitframe)
--
2.34.1
^ permalink raw reply related
* [PATCH v3 1/4] staging: rtl8723bs: simplify update_attrib_sec_info control flow
From: Hungyu Lin @ 2026-06-16 23:52 UTC (permalink / raw)
To: gregkh; +Cc: error27, linux-staging, linux-kernel, Hungyu Lin
In-Reply-To: <20260616235241.99076-1-dennylin0707@gmail.com>
Replace goto-based error handling with direct returns and
remove the temporary res variable.
No functional change.
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_xmit.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 444966c0de7f..6ab91de472b0 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -507,7 +507,6 @@ static void update_attrib_phy_info(struct adapter *padapter, struct pkt_attrib *
static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta)
{
- signed int res = _SUCCESS;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct security_priv *psecuritypriv = &padapter->securitypriv;
signed int bmcast = is_multicast_ether_addr(pattrib->ra);
@@ -519,10 +518,8 @@ static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *p
if (psta->ieee8021x_blocked) {
pattrib->encrypt = 0;
- if ((pattrib->ether_type != 0x888e) && !check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
- res = _FAIL;
- goto exit;
- }
+ if ((pattrib->ether_type != 0x888e) && !check_fwstate(pmlmepriv, WIFI_MP_STATE))
+ return _FAIL;
} else {
GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast);
@@ -560,10 +557,8 @@ static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *p
pattrib->iv_len = 8;
pattrib->icv_len = 4;
- if (psecuritypriv->busetkipkey == _FAIL) {
- res = _FAIL;
- goto exit;
- }
+ if (psecuritypriv->busetkipkey == _FAIL)
+ return _FAIL;
if (bmcast)
TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx);
@@ -601,9 +596,7 @@ static s32 update_attrib_sec_info(struct adapter *padapter, struct pkt_attrib *p
else
pattrib->bswenc = false;
-exit:
-
- return res;
+ return _SUCCESS;
}
u8 qos_acm(u8 acm_mask, u8 priority)
--
2.34.1
^ permalink raw reply related
* [PATCH v3 0/4] staging: rtl8723bs: convert update_attrib path to errno
From: Hungyu Lin @ 2026-06-16 23:52 UTC (permalink / raw)
To: gregkh; +Cc: error27, linux-staging, linux-kernel, Hungyu Lin
This series first simplifies control flow in update_attrib_sec_info()
and update_attrib() by replacing goto-based error handling with
direct returns. It then converts both functions to return errno
values and propagates the returned error codes through the caller
chain.
Changes in v3:
- Split update_attrib_sec_info() errno conversion from caller changes
- Keep update_attrib() using _FAIL in the intermediate step
- Convert update_attrib() and rtw_xmit() to propagate errno
Changes in v2:
- Keep braces around the multi-line if statement in update_attrib()
- Split errno conversion and propagation as suggested by Dan Carpenter
- Change update_attrib_sec_info() and update_attrib() return types to int
Hungyu Lin (4):
staging: rtl8723bs: simplify update_attrib_sec_info control flow
staging: rtl8723bs: simplify update_attrib control flow
staging: rtl8723bs: convert update_attrib_sec_info to return errno
staging: rtl8723bs: convert update_attrib to return errno
drivers/staging/rtl8723bs/core/rtw_xmit.c | 55 +++++++++--------------
1 file changed, 20 insertions(+), 35 deletions(-)
--
2.34.1
^ permalink raw reply
* [PATCH] staging: rtl8723bs: replace beacon timing magic numbers
From: Jad Keskes @ 2026-06-16 19:31 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Dan Carpenter, linux-staging, Jad Keskes
Break down the 0x6404 and 0x660F in
rtl8723b_InitBeaconParameters() so people don't need the out-of-tree
driver open to know what these do.
REG_TBTT_PROHIBIT (0x0540): 0x6404 = hold (0x64) and setup (0x04), both
in 32us ticks. Same layout as rtw88.
REG_BCNTCFG (0x0510): 0x660F is an EDCA-like register. Lower byte is
AIFS (0x0F = no contention before beacon), next nibble is CWmin (0x06),
top nibble is CWmax (0x06). Matches rtl8192cu which writes 0x66FF
(test chips) and 0x660F (production).
Drop the TODO since this was the last thing it referenced.
Signed-off-by: Jad Keskes <inasj268@gmail.com>
Link: https://lore.kernel.org/all/aiGMXBNQ0TbIGbpP@stanley.mountain/
---
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 5 ++---
drivers/staging/rtl8723bs/include/rtl8723b_hal.h | 13 +++++++++++++
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index bcaf63b2893c..2cf1cd9d19de 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -861,8 +861,7 @@ void rtl8723b_InitBeaconParameters(struct adapter *padapter)
rtw_write16(padapter, REG_BCN_CTRL, val16);
- /* TODO: Remove these magic number */
- rtw_write16(padapter, REG_TBTT_PROHIBIT, 0x6404);/* ms */
+ rtw_write16(padapter, REG_TBTT_PROHIBIT, TBTT_PROHIBIT_TIME_8723B);
/* Firmware will control REG_DRVERLYINT when power saving is enable, */
/* so don't set this register on STA mode. */
if (!check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE))
@@ -871,7 +870,7 @@ void rtl8723b_InitBeaconParameters(struct adapter *padapter)
/* Suggested by designer timchen. Change beacon AIFS to the largest number */
/* because test chip does not contension before sending beacon. by tynli. 2009.11.03 */
- rtw_write16(padapter, REG_BCNTCFG, 0x660F);
+ rtw_write16(padapter, REG_BCNTCFG, BCNTCFG_8723B);
pHalData->RegBcnCtrlVal = rtw_read8(padapter, REG_BCN_CTRL);
pHalData->RegTxPause = rtw_read8(padapter, REG_TXPAUSE);
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
index b6006110ad6b..aa7676828371 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
@@ -72,6 +72,19 @@ struct rt_firmware_hdr {
#define DRIVER_EARLY_INT_TIME_8723B 0x05
#define BCN_DMA_ATIME_INT_TIME_8723B 0x02
+/* REG_TBTT_PROHIBIT (0x0540) - TBTT prohibit hold/setup in 32us units */
+#define TBTT_PROHIBIT_SETUP_8723B 0x04
+#define TBTT_PROHIBIT_HOLD_8723B 0x64
+#define TBTT_PROHIBIT_TIME_8723B \
+ ((TBTT_PROHIBIT_HOLD_8723B << 8) | TBTT_PROHIBIT_SETUP_8723B)
+
+/* REG_BCNTCFG (0x0510) - beacon AIFS, CWmin, CWmax (EDCA-like layout) */
+#define BCN_AIFS_8723B 0x0F
+#define BCN_CW_MIN_8723B 0x06
+#define BCN_CW_MAX_8723B 0x06
+#define BCNTCFG_8723B \
+ ((BCN_CW_MAX_8723B << 12) | (BCN_CW_MIN_8723B << 8) | BCN_AIFS_8723B)
+
/* for 8723B */
/* TX 32K, RX 16K, Page size 128B for TX, 8B for RX */
#define PAGE_SIZE_TX_8723B 128
--
2.54.0
^ permalink raw reply related
* Re: [PATCH] staging: rtl8723bs: replace beacon timing magic numbers with named constants
From: Greg Kroah-Hartman @ 2026-06-16 17:09 UTC (permalink / raw)
To: Jad Keskes; +Cc: Dan Carpenter, linux-staging
In-Reply-To: <ajF50N_RW88mhF48@fedora>
On Tue, Jun 16, 2026 at 05:29:04PM +0100, Jad Keskes wrote:
> Ping. Any chance this can be picked up?
>
I have no context here :(
^ permalink raw reply
* [PATCH] staging: greybus: uart: replace IDR with XArray
From: Jack Lee @ 2026-06-16 19:07 UTC (permalink / raw)
To: dtwlin, johan, elder, gregkh
Cc: greybus-dev, linux-staging, linux-kernel, Jack Lee
DEFINE_IDR is deprecated in favor of XArray. Convert tty_minors
from IDR to XArray, replacing idr_alloc, idr_find, idr_remove and
idr_destroy with their xa_alloc, xa_load, xa_erase and xa_destroy
equivalents.
Signed-off-by: Jack Lee <skunkolee@gmail.com>
---
drivers/staging/greybus/uart.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index 7d060b4cd33d..30afcd0caa14 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -22,13 +22,13 @@
#include <linux/serial.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
-#include <linux/idr.h>
#include <linux/fs.h>
#include <linux/kdev_t.h>
#include <linux/kfifo.h>
#include <linux/workqueue.h>
#include <linux/completion.h>
#include <linux/greybus.h>
+#include <linux/xarray.h>
#include "gbphy.h"
@@ -67,7 +67,7 @@ struct gb_tty {
};
static struct tty_driver *gb_tty_driver;
-static DEFINE_IDR(tty_minors);
+static DEFINE_XARRAY_ALLOC(tty_minors);
static DEFINE_MUTEX(table_lock);
static int gb_uart_receive_data_handler(struct gb_operation *op)
@@ -342,7 +342,7 @@ static struct gb_tty *get_gb_by_minor(unsigned int minor)
struct gb_tty *gb_tty;
mutex_lock(&table_lock);
- gb_tty = idr_find(&tty_minors, minor);
+ gb_tty = xa_load(&tty_minors, minor);
if (gb_tty) {
mutex_lock(&gb_tty->mutex);
if (gb_tty->disconnected) {
@@ -359,14 +359,13 @@ static struct gb_tty *get_gb_by_minor(unsigned int minor)
static int alloc_minor(struct gb_tty *gb_tty)
{
- int minor;
+ int ret;
- mutex_lock(&table_lock);
- minor = idr_alloc(&tty_minors, gb_tty, 0, GB_NUM_MINORS, GFP_KERNEL);
- mutex_unlock(&table_lock);
- if (minor >= 0)
- gb_tty->minor = minor;
- return minor;
+ ret = xa_alloc(&tty_minors, &gb_tty->minor, gb_tty,
+ XA_LIMIT(0, GB_NUM_MINORS - 1), GFP_KERNEL);
+ if (ret)
+ return ret;
+ return gb_tty->minor;
}
static void release_minor(struct gb_tty *gb_tty)
@@ -375,7 +374,7 @@ static void release_minor(struct gb_tty *gb_tty)
gb_tty->minor = 0; /* Maybe should use an invalid value instead */
mutex_lock(&table_lock);
- idr_remove(&tty_minors, minor);
+ xa_erase(&tty_minors, minor);
mutex_unlock(&table_lock);
}
@@ -984,7 +983,7 @@ static void gb_tty_exit(void)
{
tty_unregister_driver(gb_tty_driver);
tty_driver_kref_put(gb_tty_driver);
- idr_destroy(&tty_minors);
+ xa_destroy(&tty_minors);
}
static const struct gbphy_device_id gb_uart_id_table[] = {
--
2.54.0
^ permalink raw reply related
* Re: [PATCH] staging: rtl8723bs: replace beacon timing magic numbers with named constants
From: Jad Keskes @ 2026-06-16 16:29 UTC (permalink / raw)
To: inasj268; +Cc: Greg Kroah-Hartman, Dan Carpenter, linux-staging
Ping. Any chance this can be picked up?
^ 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