hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/hsi/controllers/omap_ssi_port.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* OMAP SSI port driver.
23 *
34 * Copyright (C) 2010 Nokia Corporation. All rights reserved.
45 * Copyright (C) 2014 Sebastian Reichel <sre@kernel.org>
56 *
67 * Contact: Carlos Chinea <carlos.chinea@nokia.com>
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * version 2 as published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful, but
13
- * WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
- * 02110-1301 USA
218 */
229
2310 #include <linux/mod_devicetable.h>
....@@ -57,7 +44,7 @@
5744 debugfs_remove_recursive(omap_port->dir);
5845 }
5946
60
-static int ssi_debug_port_show(struct seq_file *m, void *p __maybe_unused)
47
+static int ssi_port_regs_show(struct seq_file *m, void *p __maybe_unused)
6148 {
6249 struct hsi_port *port = m->private;
6350 struct omap_ssi_port *omap_port = hsi_port_drvdata(port);
....@@ -132,17 +119,7 @@
132119 return 0;
133120 }
134121
135
-static int ssi_port_regs_open(struct inode *inode, struct file *file)
136
-{
137
- return single_open(file, ssi_debug_port_show, inode->i_private);
138
-}
139
-
140
-static const struct file_operations ssi_port_regs_fops = {
141
- .open = ssi_port_regs_open,
142
- .read = seq_read,
143
- .llseek = seq_lseek,
144
- .release = single_release,
145
-};
122
+DEFINE_SHOW_ATTRIBUTE(ssi_port_regs);
146123
147124 static int ssi_div_get(void *data, u64 *val)
148125 {
....@@ -172,7 +149,7 @@
172149 return 0;
173150 }
174151
175
-DEFINE_SIMPLE_ATTRIBUTE(ssi_sst_div_fops, ssi_div_get, ssi_div_set, "%llu\n");
152
+DEFINE_DEBUGFS_ATTRIBUTE(ssi_sst_div_fops, ssi_div_get, ssi_div_set, "%llu\n");
176153
177154 static int ssi_debug_add_port(struct omap_ssi_port *omap_port,
178155 struct dentry *dir)
....@@ -187,8 +164,8 @@
187164 dir = debugfs_create_dir("sst", dir);
188165 if (!dir)
189166 return -ENOMEM;
190
- debugfs_create_file("divisor", S_IRUGO | S_IWUSR, dir, port,
191
- &ssi_sst_div_fops);
167
+ debugfs_create_file_unsafe("divisor", 0644, dir, port,
168
+ &ssi_sst_div_fops);
192169
193170 return 0;
194171 }
....@@ -253,10 +230,10 @@
253230 if (msg->ttype == HSI_MSG_READ) {
254231 err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents,
255232 DMA_FROM_DEVICE);
256
- if (err < 0) {
233
+ if (!err) {
257234 dev_dbg(&ssi->device, "DMA map SG failed !\n");
258235 pm_runtime_put_autosuspend(omap_port->pdev);
259
- return err;
236
+ return -EIO;
260237 }
261238 csdp = SSI_DST_BURST_4x32_BIT | SSI_DST_MEMORY_PORT |
262239 SSI_SRC_SINGLE_ACCESS0 | SSI_SRC_PERIPHERAL_PORT |
....@@ -270,10 +247,10 @@
270247 } else {
271248 err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents,
272249 DMA_TO_DEVICE);
273
- if (err < 0) {
250
+ if (!err) {
274251 dev_dbg(&ssi->device, "DMA map SG failed !\n");
275252 pm_runtime_put_autosuspend(omap_port->pdev);
276
- return err;
253
+ return -EIO;
277254 }
278255 csdp = SSI_SRC_BURST_4x32_BIT | SSI_SRC_MEMORY_PORT |
279256 SSI_DST_SINGLE_ACCESS0 | SSI_DST_PERIPHERAL_PORT |
....@@ -1061,10 +1038,8 @@
10611038 int err;
10621039
10631040 err = platform_get_irq(pd, 0);
1064
- if (err < 0) {
1065
- dev_err(&port->device, "Port IRQ resource missing\n");
1041
+ if (err < 0)
10661042 return err;
1067
- }
10681043 omap_port->irq = err;
10691044 err = devm_request_threaded_irq(&port->device, omap_port->irq, NULL,
10701045 ssi_pio_thread, IRQF_ONESHOT, "SSI PORT", port);