forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/firewire/core-cdev.c
....@@ -1,21 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Char device for device raw access
34 *
45 * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software Foundation,
18
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
196 */
207
218 #include <linux/bug.h>
....@@ -130,7 +117,7 @@
130117 struct descriptor_resource {
131118 struct client_resource resource;
132119 struct fw_descriptor descriptor;
133
- u32 data[0];
120
+ u32 data[];
134121 };
135122
136123 struct iso_resource {
....@@ -1094,8 +1081,6 @@
10941081 return -EINVAL;
10951082
10961083 p = (struct fw_cdev_iso_packet __user *)u64_to_uptr(a->packets);
1097
- if (!access_ok(VERIFY_READ, p, a->size))
1098
- return -EFAULT;
10991084
11001085 end = (void __user *)p + a->size;
11011086 count = 0;
....@@ -1133,7 +1118,7 @@
11331118 &p->header[transmit_header_bytes / 4];
11341119 if (next > end)
11351120 return -EINVAL;
1136
- if (__copy_from_user
1121
+ if (copy_from_user
11371122 (u.packet.header, p->header, transmit_header_bytes))
11381123 return -EFAULT;
11391124 if (u.packet.skip && ctx->type == FW_ISO_CONTEXT_TRANSMIT &&
....@@ -1495,6 +1480,7 @@
14951480 {
14961481 struct outbound_phy_packet_event *e =
14971482 container_of(packet, struct outbound_phy_packet_event, p);
1483
+ struct client *e_client;
14981484
14991485 switch (status) {
15001486 /* expected: */
....@@ -1511,9 +1497,10 @@
15111497 }
15121498 e->phy_packet.data[0] = packet->timestamp;
15131499
1500
+ e_client = e->client;
15141501 queue_event(e->client, &e->event, &e->phy_packet,
15151502 sizeof(e->phy_packet) + e->phy_packet.length, NULL, 0);
1516
- client_put(e->client);
1503
+ client_put(e_client);
15171504 }
15181505
15191506 static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg)
....@@ -1659,14 +1646,6 @@
16591646 return dispatch_ioctl(file->private_data, cmd, (void __user *)arg);
16601647 }
16611648
1662
-#ifdef CONFIG_COMPAT
1663
-static long fw_device_op_compat_ioctl(struct file *file,
1664
- unsigned int cmd, unsigned long arg)
1665
-{
1666
- return dispatch_ioctl(file->private_data, cmd, compat_ptr(arg));
1667
-}
1668
-#endif
1669
-
16701649 static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma)
16711650 {
16721651 struct client *client = file->private_data;
....@@ -1707,7 +1686,8 @@
17071686 if (ret < 0)
17081687 goto fail;
17091688
1710
- ret = fw_iso_buffer_map_vma(&client->buffer, vma);
1689
+ ret = vm_map_pages_zero(vma, client->buffer.pages,
1690
+ client->buffer.page_count);
17111691 if (ret < 0)
17121692 goto fail;
17131693
....@@ -1808,7 +1788,5 @@
18081788 .mmap = fw_device_op_mmap,
18091789 .release = fw_device_op_release,
18101790 .poll = fw_device_op_poll,
1811
-#ifdef CONFIG_COMPAT
1812
- .compat_ioctl = fw_device_op_compat_ioctl,
1813
-#endif
1791
+ .compat_ioctl = compat_ptr_ioctl,
18141792 };