Skip to content

Commit e88c9a7

Browse files
committed
soc: aspeed: lpc-snoop: Rename 'channel' to 'index' in channel paths
We'll introduce another 'channel' variable shortly Acked-by: Jean Delvare <jdelvare@suse.de> Link: https://patch.msgid.link/20250616-aspeed-lpc-snoop-fixes-v2-5-3cdd59c934d3@codeconstruct.com.au Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
1 parent 3e9c157 commit e88c9a7

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

drivers/soc/aspeed/aspeed-lpc-snoop.c

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -190,37 +190,37 @@ static int aspeed_lpc_snoop_config_irq(struct aspeed_lpc_snoop *lpc_snoop,
190190
__attribute__((nonnull))
191191
static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
192192
struct device *dev,
193-
enum aspeed_lpc_snoop_index channel, u16 lpc_port)
193+
enum aspeed_lpc_snoop_index index, u16 lpc_port)
194194
{
195195
const struct aspeed_lpc_snoop_model_data *model_data;
196196
u32 hicr5_en, snpwadr_mask, snpwadr_shift, hicrb_en;
197197
int rc = 0;
198198

199-
if (WARN_ON(lpc_snoop->chan[channel].enabled))
199+
if (WARN_ON(lpc_snoop->chan[index].enabled))
200200
return -EBUSY;
201201

202-
init_waitqueue_head(&lpc_snoop->chan[channel].wq);
202+
init_waitqueue_head(&lpc_snoop->chan[index].wq);
203203
/* Create FIFO datastructure */
204-
rc = kfifo_alloc(&lpc_snoop->chan[channel].fifo,
204+
rc = kfifo_alloc(&lpc_snoop->chan[index].fifo,
205205
SNOOP_FIFO_SIZE, GFP_KERNEL);
206206
if (rc)
207207
return rc;
208208

209-
lpc_snoop->chan[channel].miscdev.minor = MISC_DYNAMIC_MINOR;
210-
lpc_snoop->chan[channel].miscdev.name =
211-
devm_kasprintf(dev, GFP_KERNEL, "%s%d", DEVICE_NAME, channel);
212-
if (!lpc_snoop->chan[channel].miscdev.name) {
209+
lpc_snoop->chan[index].miscdev.minor = MISC_DYNAMIC_MINOR;
210+
lpc_snoop->chan[index].miscdev.name =
211+
devm_kasprintf(dev, GFP_KERNEL, "%s%d", DEVICE_NAME, index);
212+
if (!lpc_snoop->chan[index].miscdev.name) {
213213
rc = -ENOMEM;
214214
goto err_free_fifo;
215215
}
216-
lpc_snoop->chan[channel].miscdev.fops = &snoop_fops;
217-
lpc_snoop->chan[channel].miscdev.parent = dev;
218-
rc = misc_register(&lpc_snoop->chan[channel].miscdev);
216+
lpc_snoop->chan[index].miscdev.fops = &snoop_fops;
217+
lpc_snoop->chan[index].miscdev.parent = dev;
218+
rc = misc_register(&lpc_snoop->chan[index].miscdev);
219219
if (rc)
220220
goto err_free_fifo;
221221

222222
/* Enable LPC snoop channel at requested port */
223-
switch (channel) {
223+
switch (index) {
224224
case 0:
225225
hicr5_en = HICR5_EN_SNP0W | HICR5_ENINT_SNP0W;
226226
snpwadr_mask = SNPWADR_CH0_MASK;
@@ -246,25 +246,26 @@ static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
246246
if (model_data && model_data->has_hicrb_ensnp)
247247
regmap_update_bits(lpc_snoop->regmap, HICRB, hicrb_en, hicrb_en);
248248

249-
lpc_snoop->chan[channel].enabled = true;
249+
lpc_snoop->chan[index].enabled = true;
250250

251251
return 0;
252252

253253
err_misc_deregister:
254-
misc_deregister(&lpc_snoop->chan[channel].miscdev);
254+
misc_deregister(&lpc_snoop->chan[index].miscdev);
255255
err_free_fifo:
256-
kfifo_free(&lpc_snoop->chan[channel].fifo);
256+
kfifo_free(&lpc_snoop->chan[index].fifo);
257257
return rc;
258258
}
259259

260260
__attribute__((nonnull))
261261
static void aspeed_lpc_disable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
262-
enum aspeed_lpc_snoop_index channel)
262+
enum aspeed_lpc_snoop_index index)
263263
{
264-
if (!lpc_snoop->chan[channel].enabled)
264+
if (!lpc_snoop->chan[index].enabled)
265265
return;
266266

267-
switch (channel) {
267+
/* Disable interrupts along with the device */
268+
switch (index) {
268269
case 0:
269270
regmap_update_bits(lpc_snoop->regmap, HICR5,
270271
HICR5_EN_SNP0W | HICR5_ENINT_SNP0W,
@@ -279,10 +280,10 @@ static void aspeed_lpc_disable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
279280
return;
280281
}
281282

282-
lpc_snoop->chan[channel].enabled = false;
283+
lpc_snoop->chan[index].enabled = false;
283284
/* Consider improving safety wrt concurrent reader(s) */
284-
misc_deregister(&lpc_snoop->chan[channel].miscdev);
285-
kfifo_free(&lpc_snoop->chan[channel].fifo);
285+
misc_deregister(&lpc_snoop->chan[index].miscdev);
286+
kfifo_free(&lpc_snoop->chan[index].fifo);
286287
}
287288

288289
static int aspeed_lpc_snoop_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)