Skip to content

Commit e0dcd2b

Browse files
committed
Merge tag 'hsi-for-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi
Pull HSI updates from Sebastian Reichel: - use flexible array member for hsi_port in hsi_controller - misc small fixes * tag 'hsi-for-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi: HSI: omap_ssi_port: remove depends on ARM HSI: omap_ssi_port: remove set but unused variables HSI: cmt_speech: fix wrong printf format HSI: omap_ssi_port: remove null check from FAM hsi: hsi_core: use kzalloc_flex
2 parents d97e7d7 + df5ead9 commit e0dcd2b

5 files changed

Lines changed: 21 additions & 31 deletions

File tree

drivers/hsi/clients/cmt_speech.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ static void cs_hsi_data_enable(struct cs_hsi_iface *hi,
892892

893893
data_start = L1_CACHE_ALIGN(sizeof(*hi->mmap_cfg));
894894
dev_dbg(&hi->cl->device,
895-
"setting data start at %u, cfg block %u, align %u\n",
895+
"setting data start at %u, cfg block %zu, align %u\n",
896896
data_start, sizeof(*hi->mmap_cfg), L1_CACHE_BYTES);
897897

898898
for (i = 0; i < hi->mmap_cfg->rx_bufs; i++) {

drivers/hsi/controllers/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ comment "HSI controllers"
66

77
config OMAP_SSI
88
tristate "OMAP SSI hardware driver"
9-
depends on HSI && OF && ARM && COMMON_CLK
9+
depends on HSI && OF && COMMON_CLK
1010
depends on ARCH_OMAP3 || COMPILE_TEST
1111
help
1212
SSI is a legacy version of HSI. It is usually used to connect

drivers/hsi/controllers/omap_ssi_port.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,6 @@ static int ssi_setup(struct hsi_client *cl)
452452
void __iomem *sst = omap_port->sst_base;
453453
void __iomem *ssr = omap_port->ssr_base;
454454
u32 div;
455-
u32 val;
456455
int err = 0;
457456

458457
pm_runtime_get_sync(omap_port->pdev);
@@ -470,7 +469,7 @@ static int ssi_setup(struct hsi_client *cl)
470469
writel_relaxed(SSI_MODE_SLEEP, sst + SSI_SST_MODE_REG);
471470
writel_relaxed(SSI_MODE_SLEEP, ssr + SSI_SSR_MODE_REG);
472471
/* Flush posted write */
473-
val = readl(ssr + SSI_SSR_MODE_REG);
472+
readl(ssr + SSI_SSR_MODE_REG);
474473
/* TX */
475474
writel_relaxed(31, sst + SSI_SST_FRAMESIZE_REG);
476475
writel_relaxed(div, sst + SSI_SST_DIVISOR_REG);
@@ -1118,7 +1117,7 @@ static int ssi_port_probe(struct platform_device *pd)
11181117

11191118
dev_dbg(&pd->dev, "init ssi port...\n");
11201119

1121-
if (!ssi->port || !omap_ssi->port) {
1120+
if (!omap_ssi->port) {
11221121
dev_err(&pd->dev, "ssi controller not initialized!\n");
11231122
err = -ENODEV;
11241123
goto error;
@@ -1299,14 +1298,12 @@ static int ssi_restore_port_ctx(struct omap_ssi_port *omap_port)
12991298

13001299
static int ssi_restore_port_mode(struct omap_ssi_port *omap_port)
13011300
{
1302-
u32 mode;
1303-
13041301
writel_relaxed(omap_port->sst.mode,
13051302
omap_port->sst_base + SSI_SST_MODE_REG);
13061303
writel_relaxed(omap_port->ssr.mode,
13071304
omap_port->ssr_base + SSI_SSR_MODE_REG);
13081305
/* OCP barrier */
1309-
mode = readl(omap_port->ssr_base + SSI_SSR_MODE_REG);
1306+
readl(omap_port->ssr_base + SSI_SSR_MODE_REG);
13101307

13111308
return 0;
13121309
}

drivers/hsi/hsi_core.c

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ static void hsi_controller_release(struct device *dev)
342342
{
343343
struct hsi_controller *hsi = to_hsi_controller(dev);
344344

345-
kfree(hsi->port);
346345
kfree(hsi);
347346
}
348347

@@ -446,7 +445,7 @@ void hsi_put_controller(struct hsi_controller *hsi)
446445
return;
447446

448447
for (i = 0; i < hsi->num_ports; i++)
449-
if (hsi->port && hsi->port[i])
448+
if (hsi->port[i])
450449
put_device(&hsi->port[i]->device);
451450
put_device(&hsi->device);
452451
}
@@ -462,39 +461,33 @@ EXPORT_SYMBOL_GPL(hsi_put_controller);
462461
struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags)
463462
{
464463
struct hsi_controller *hsi;
465-
struct hsi_port **port;
466464
unsigned int i;
467465

468466
if (!n_ports)
469467
return NULL;
470468

471-
hsi = kzalloc_obj(*hsi, flags);
469+
hsi = kzalloc_flex(*hsi, port, n_ports, flags);
472470
if (!hsi)
473471
return NULL;
474-
port = kzalloc_objs(*port, n_ports, flags);
475-
if (!port) {
476-
kfree(hsi);
477-
return NULL;
478-
}
472+
479473
hsi->num_ports = n_ports;
480-
hsi->port = port;
481474
hsi->device.release = hsi_controller_release;
482475
device_initialize(&hsi->device);
483476

484477
for (i = 0; i < n_ports; i++) {
485-
port[i] = kzalloc_obj(**port, flags);
486-
if (port[i] == NULL)
478+
hsi->port[i] = kzalloc_obj(**hsi->port, flags);
479+
if (hsi->port[i] == NULL)
487480
goto out;
488-
port[i]->num = i;
489-
port[i]->async = hsi_dummy_msg;
490-
port[i]->setup = hsi_dummy_cl;
491-
port[i]->flush = hsi_dummy_cl;
492-
port[i]->start_tx = hsi_dummy_cl;
493-
port[i]->stop_tx = hsi_dummy_cl;
494-
port[i]->release = hsi_dummy_cl;
495-
mutex_init(&port[i]->lock);
496-
BLOCKING_INIT_NOTIFIER_HEAD(&port[i]->n_head);
497-
dev_set_name(&port[i]->device, "port%d", i);
481+
hsi->port[i]->num = i;
482+
hsi->port[i]->async = hsi_dummy_msg;
483+
hsi->port[i]->setup = hsi_dummy_cl;
484+
hsi->port[i]->flush = hsi_dummy_cl;
485+
hsi->port[i]->start_tx = hsi_dummy_cl;
486+
hsi->port[i]->stop_tx = hsi_dummy_cl;
487+
hsi->port[i]->release = hsi_dummy_cl;
488+
mutex_init(&hsi->port[i]->lock);
489+
BLOCKING_INIT_NOTIFIER_HEAD(&hsi->port[i]->n_head);
490+
dev_set_name(&hsi->port[i]->device, "port%d", i);
498491
hsi->port[i]->device.release = hsi_port_release;
499492
device_initialize(&hsi->port[i]->device);
500493
}

include/linux/hsi/hsi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ struct hsi_controller {
271271
struct module *owner;
272272
unsigned int id;
273273
unsigned int num_ports;
274-
struct hsi_port **port;
274+
struct hsi_port *port[] __counted_by(num_ports);
275275
};
276276

277277
#define to_hsi_controller(dev) container_of(dev, struct hsi_controller, device)

0 commit comments

Comments
 (0)