Re: [PATCH] mips: cavium-octeon: remove cmd queue state and related typedefs

Dan Carpenter
2026-04-17T14:02:18Z

On Thu, Apr 16, 2026 at 09:36:02PM -0500, Maxwell Doose wrote:
> diff --git a/arch/mips/include/asm/octeon/cvmx-cmd-queue.h b/arch/mips/include/asm/octeon/cvmx-cmd-queue.h
> index 67e1b2162b19..faef98173a4f 100644
> --- a/arch/mips/include/asm/octeon/cvmx-cmd-queue.h
> +++ b/arch/mips/include/asm/octeon/cvmx-cmd-queue.h
> @@ -71,6 +71,12 @@
> *
> */
>
> +/* Global pointer to the state of command the queues
> + * Moved here to satisfy requirements in cvmx-cmd-queue.c for EXPORT_SYMBOL_GPL
> + */
> +extern struct __cvmx_cmd_queue_all_state
> + *__cvmx_cmd_queue_state_ptr;
> +

This is arch/mips/ and that's a different tree from staging with
different maintainers. Generally, the rest of the kernel doesn't like
churn so I probably wouldn't send patches like this one for arch/mips/.

This comment isn't accurate. This is a Sparse thing and nothing to do
with EXPORT_SYMBOL_GPL.

Normally we would decare variables like this in a header file, sure.
I guess the original authors wanted make absolutely sure no one ever
used this variable so they declared as an extern in
__cvmx_cmd_queue_state_ptr() __cvmx_cmd_queue_get_state(). It's unusual
and paranoid but I can't think of another reason why they would do it.
Generally, outside of staging, you just go along with whatever the
original author wanted. They did the work after all, so they get to
decide.

This patch removes the declaration in __cvmx_cmd_queue_state_ptr() but
leaves it in __cvmx_cmd_queue_get_state(). We definitely can't do that.
And we can't mix this in with a remove typedefs patch.

regards,
dan carpenter

> @@ -234,10 +240,8 @@ static inline int __cvmx_cmd_queue_get_index(cvmx_cmd_queue_id_t queue_id)
> * @qptr: Pointer to the queue's global state
> */
> static inline void __cvmx_cmd_queue_lock(cvmx_cmd_queue_id_t queue_id,
> - __cvmx_cmd_queue_state_t *qptr)
> + struct __cvmx_cmd_queue_state *qptr)
> {
> - extern __cvmx_cmd_queue_all_state_t
> - *__cvmx_cmd_queue_state_ptr;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> int tmp;
> int my_ticket;
> prefetch(qptr);

[ snip]

> @@ -299,10 +303,10 @@ static inline void __cvmx_cmd_queue_unlock(__cvmx_cmd_queue_state_t *qptr)
> *
> * Returns Queue structure or NULL on failure
> */
> -static inline __cvmx_cmd_queue_state_t
> +static inline struct __cvmx_cmd_queue_state
> *__cvmx_cmd_queue_get_state(cvmx_cmd_queue_id_t queue_id)
> {
> - extern __cvmx_cmd_queue_all_state_t
> + extern struct __cvmx_cmd_queue_all_state
> *__cvmx_cmd_queue_state_ptr;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> return &__cvmx_cmd_queue_state_ptr->
> state[__cvmx_cmd_queue_get_index(queue_id)];