ASPEED SoC driver fixes for 6.16

Address concerns in the ASPEED LPC snoop driver identified in the first two
 patches of the cleanup series at [1].
 
 [1]: https://lore.kernel.org/all/20250616-aspeed-lpc-snoop-fixes-v2-0-3cdd59c934d3@codeconstruct.com.au/
 -----BEGIN PGP SIGNATURE-----
 
 iJIEABYIADoWIQSoUT1x3bOSX/nAa8ajM9GZTrjhpgUCaGyDXRwcYW5kcmV3QGNv
 ZGVjb25zdHJ1Y3QuY29tLmF1AAoJEKMz0ZlOuOGmgn8BAPPjymrNsFLeu4rjN8YH
 MyLMMQIKDQ7y0mrj5TFrfG38AP0ZJLcwACV2Fl1++uVrI3Ibj73Mtd7C5nIDiAKr
 aG1aBQ==
 =pX3h
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmhw98gACgkQmmx57+YA
 GNnIBA/5AQHJf+UEwDQXyK7h5gWRbchsjBcs2h4K2NfN8KrJZXMyr/Y/eJtmyndJ
 SDX/x9kgA+8PT9PdOs87q646KXOSN73j7ixKXd/4EMRoNi4toJuZRlcOOj7Uof9u
 Ml/ycVZSEchHQl1umOdTmlbgGw3bq4A6M5Qdes0IUyr6FknugpsaLfP2GinsUdMR
 vv7FoEaF86UNv6AkdxYBt+rgA+hRio2ovbaItZhpGrWqU+FMH9Td+H8u8A7HtZbe
 Jz8BIqkVv5jTIwFP64MsbvJ2Cd3uN+uxYYtyzAPmgz5XGs2qmOShwnk7ORUiWGk/
 OWP8o38OILo3JWYFv0szqPB40VNIyj9yFnLks8382ytwYFdsaMVmDgKCiu8uNwVX
 oQMLu+7TnjrCAa8hGXp62kpP8pICjQVcZCYUHzAsfysGzOzpQSg6HfyeBz7/IFIY
 SivIM2cY+alQrT5Tf0idGNULKdCuKonzHQvY0+uCTdsn1OUD9J7lrigCzORaXCHR
 ePJYB2HH0V83rbvxm8R9azeBTY1w2vmkB8OmiexMjZlEZmgCBlcNY8qWENJvGycv
 U7fbTf4o4kBCdhT8JH+u5Gxq3Ucblw0u0Yck5Eb+rpH8ej7gBbNGopZrXe3Qm/R3
 /YEXE6vTHenaX8RNnQ/gvgdkPMOHbo7VAH+2mca5PrSB8qhc+zw=
 =pKBI
 -----END PGP SIGNATURE-----

Merge tag 'aspeed-6.16-fixes-0' of https://git.kernel.org/pub/scm/linux/kernel/git/bmc/linux into arm/fixes

ASPEED SoC driver fixes for 6.16

Address concerns in the ASPEED LPC snoop driver identified in the first two
patches of the cleanup series at [1].

[1]: https://lore.kernel.org/all/20250616-aspeed-lpc-snoop-fixes-v2-0-3cdd59c934d3@codeconstruct.com.au/

* tag 'aspeed-6.16-fixes-0' of https://git.kernel.org/pub/scm/linux/kernel/git/bmc/linux:
  soc: aspeed: lpc-snoop: Don't disable channels that aren't enabled
  soc: aspeed: lpc-snoop: Cleanup resources in stack-order

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2025-07-11 13:38:35 +02:00
commit 07d45e8096

View File

@ -58,6 +58,7 @@ struct aspeed_lpc_snoop_model_data {
};
struct aspeed_lpc_snoop_channel {
bool enabled;
struct kfifo fifo;
wait_queue_head_t wq;
struct miscdevice miscdev;
@ -190,6 +191,9 @@ static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
const struct aspeed_lpc_snoop_model_data *model_data =
of_device_get_match_data(dev);
if (WARN_ON(lpc_snoop->chan[channel].enabled))
return -EBUSY;
init_waitqueue_head(&lpc_snoop->chan[channel].wq);
/* Create FIFO datastructure */
rc = kfifo_alloc(&lpc_snoop->chan[channel].fifo,
@ -236,6 +240,8 @@ static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
regmap_update_bits(lpc_snoop->regmap, HICRB,
hicrb_en, hicrb_en);
lpc_snoop->chan[channel].enabled = true;
return 0;
err_misc_deregister:
@ -248,6 +254,9 @@ static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
static void aspeed_lpc_disable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
int channel)
{
if (!lpc_snoop->chan[channel].enabled)
return;
switch (channel) {
case 0:
regmap_update_bits(lpc_snoop->regmap, HICR5,
@ -263,8 +272,10 @@ static void aspeed_lpc_disable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
return;
}
kfifo_free(&lpc_snoop->chan[channel].fifo);
lpc_snoop->chan[channel].enabled = false;
/* Consider improving safety wrt concurrent reader(s) */
misc_deregister(&lpc_snoop->chan[channel].miscdev);
kfifo_free(&lpc_snoop->chan[channel].fifo);
}
static int aspeed_lpc_snoop_probe(struct platform_device *pdev)