Skip to content

Commit f3ed97f

Browse files
pinchartltomba
authored andcommitted
drm/omap: dsi: Simplify debugfs implementation
The DSI debugfs regs and irqs show handlers received a pointer to the DSI private data. There's no need to look it up from the list of DSS outputs. Use the pointer directly, this allows simplifying the implementation of the handlers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent 7269fde commit f3ed97f

File tree

1 file changed

+14
-49
lines changed
  • drivers/gpu/drm/omapdrm/dss

1 file changed

+14
-49
lines changed

drivers/gpu/drm/omapdrm/dss/dsi.c

Lines changed: 14 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,8 +1518,9 @@ void dsi_dump_clocks(struct seq_file *s)
15181518
}
15191519

15201520
#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
1521-
static void dsi_dump_dsi_irqs(struct dsi_data *dsi, struct seq_file *s)
1521+
static int dsi_dump_dsi_irqs(struct seq_file *s, void *p)
15221522
{
1523+
struct dsi_data *dsi = p;
15231524
unsigned long flags;
15241525
struct dsi_irq_stats stats;
15251526

@@ -1603,33 +1604,20 @@ static void dsi_dump_dsi_irqs(struct dsi_data *dsi, struct seq_file *s)
16031604
PIS(ULPSACTIVENOT_ALL0);
16041605
PIS(ULPSACTIVENOT_ALL1);
16051606
#undef PIS
1606-
}
1607-
1608-
static int dsi1_dump_irqs(struct seq_file *s, void *p)
1609-
{
1610-
struct dsi_data *dsi = dsi_get_dsi_from_id(0);
16111607

1612-
dsi_dump_dsi_irqs(dsi, s);
1613-
return 0;
1614-
}
1615-
1616-
static int dsi2_dump_irqs(struct seq_file *s, void *p)
1617-
{
1618-
struct dsi_data *dsi = dsi_get_dsi_from_id(1);
1619-
1620-
dsi_dump_dsi_irqs(dsi, s);
16211608
return 0;
16221609
}
16231610
#endif
16241611

1625-
static void dsi_dump_dsi_regs(struct dsi_data *dsi, struct seq_file *s)
1612+
static int dsi_dump_dsi_regs(struct seq_file *s, void *p)
16261613
{
1627-
#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsi, r))
1614+
struct dsi_data *dsi = p;
16281615

16291616
if (dsi_runtime_get(dsi))
1630-
return;
1617+
return 0;
16311618
dsi_enable_scp_clk(dsi);
16321619

1620+
#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsi, r))
16331621
DUMPREG(DSI_REVISION);
16341622
DUMPREG(DSI_SYSCONFIG);
16351623
DUMPREG(DSI_SYSSTATUS);
@@ -1699,25 +1687,11 @@ static void dsi_dump_dsi_regs(struct dsi_data *dsi, struct seq_file *s)
16991687
DUMPREG(DSI_PLL_GO);
17001688
DUMPREG(DSI_PLL_CONFIGURATION1);
17011689
DUMPREG(DSI_PLL_CONFIGURATION2);
1690+
#undef DUMPREG
17021691

17031692
dsi_disable_scp_clk(dsi);
17041693
dsi_runtime_put(dsi);
1705-
#undef DUMPREG
1706-
}
1707-
1708-
static int dsi1_dump_regs(struct seq_file *s, void *p)
1709-
{
1710-
struct dsi_data *dsi = dsi_get_dsi_from_id(0);
17111694

1712-
dsi_dump_dsi_regs(dsi, s);
1713-
return 0;
1714-
}
1715-
1716-
static int dsi2_dump_regs(struct seq_file *s, void *p)
1717-
{
1718-
struct dsi_data *dsi = dsi_get_dsi_from_id(1);
1719-
1720-
dsi_dump_dsi_regs(dsi, s);
17211695
return 0;
17221696
}
17231697

@@ -5305,6 +5279,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
53055279
struct dsi_data *dsi;
53065280
struct resource *dsi_mem;
53075281
struct resource *res;
5282+
char name[10];
53085283

53095284
dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
53105285
if (!dsi)
@@ -5443,23 +5418,13 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
54435418

54445419
dsi_runtime_put(dsi);
54455420

5446-
if (dsi->module_id == 0)
5447-
dsi->debugfs.regs = dss_debugfs_create_file(dss, "dsi1_regs",
5448-
dsi1_dump_regs,
5449-
&dsi);
5450-
else
5451-
dsi->debugfs.regs = dss_debugfs_create_file(dss, "dsi2_regs",
5452-
dsi2_dump_regs,
5453-
&dsi);
5421+
snprintf(name, sizeof(name), "dsi%u_regs", dsi->module_id + 1);
5422+
dsi->debugfs.regs = dss_debugfs_create_file(dss, name,
5423+
dsi_dump_dsi_regs, &dsi);
54545424
#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
5455-
if (dsi->module_id == 0)
5456-
dsi->debugfs.irqs = dss_debugfs_create_file(dss, "dsi1_irqs",
5457-
dsi1_dump_irqs,
5458-
&dsi);
5459-
else
5460-
dsi->debugfs.irqs = dss_debugfs_create_file(dss, "dsi2_irqs",
5461-
dsi2_dump_irqs,
5462-
&dsi);
5425+
snprintf(name, sizeof(name), "dsi%u_irqs", dsi->module_id + 1);
5426+
dsi->debugfs.irqs = dss_debugfs_create_file(dss, name,
5427+
dsi_dump_dsi_irqs, &dsi);
54635428
#endif
54645429

54655430
return 0;

0 commit comments

Comments
 (0)