[PATCH v6 3/7] gpio: aspeed: Create llops to handle hardware access

Andrew Jeffery andrew at codeconstruct.com.au
Mon Sep 30 14:00:25 AEST 2024


On Fri, 2024-09-27 at 19:17 +0800, Billy Tsai wrote:
> 
> +
> +static const struct aspeed_gpio_llops aspeed_g4_llops = {
> +	.copro_request = aspeed_g4_copro_request,
> +	.copro_release = aspeed_g4_copro_release,
> +	.reg_bit_set = aspeed_g4_reg_bit_set,
> +	.reg_bit_get = aspeed_g4_reg_bit_get,
> +	.reg_bank_get = aspeed_g4_reg_bank_get,
> +	.privilege_ctrl = aspeed_g4_privilege_ctrl,
> +	.privilege_init = aspeed_g4_privilege_init,
> +};

A brief nitpick as I have another comment below - can you order these
assignments in the same order as the member declarations in the struct
(you re-ordered that in v6)?

> @@ -1191,6 +1214,10 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
>  
>  	gpio->config = gpio_id->data;
>  
> +	if (!gpio->config->llops->reg_bit_set || !gpio->config->llops->reg_bit_get ||
> +	    !gpio->config->llops->reg_bank_get)
> +		return -EINVAL;
> +

I think the patch is largely in good shape. I've given it some light
testing. The only concern I have is this is introducing another
resource cleanup bug right now, but that's only because you've ordered
the devm_clk_get_enabled() patch as the last in the series. If you
order it before this patch then the direct return above should no-
longer be a concern.

Andrew


More information about the Linux-aspeed mailing list