Skip to content

Commit c189354

Browse files
committed
恐らくCのコードがビルド通るように型変換をした。
[WIP]Makefile関連を修正する必要あり
1 parent 4ac2d37 commit c189354

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/drivers/dts/rtmouse.dts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
target = <&spi0>;
99
__overlay__ {
1010
status = "okay";
11+
#address-cells = <1>;
12+
#size-cells = <0>;
13+
1114
mcp3208: mcp3208@0 {
1215
compatible = "microchip,mcp3208";
1316
reg = <0>;

src/drivers/rtmouse.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#include <linux/sched.h>
4141
#include <linux/slab.h>
4242
#include <linux/spi/spi.h>
43+
#include <linux/of_platform.h>
44+
#include <linux/platform_device.h>
4345
#include <linux/stat.h>
4446
#include <linux/timer.h>
4547
#include <linux/types.h>
@@ -51,7 +53,7 @@
5153
// Raspberry Pi 2 B : 2
5254
// Raspberry Pi 3 B/A+/B+ : 2
5355
// Raspberry Pi 4 B : 4
54-
#define RASPBERRYPI 2
56+
#define RASPBERRYPI 4
5557

5658
MODULE_AUTHOR("RT Corporation");
5759
MODULE_LICENSE("GPL");
@@ -1877,11 +1879,14 @@ static struct spi_master* spi_get_master(const char *spi_name)
18771879
return -ENODEV;
18781880
}
18791881

1880-
strcut device *dev;
1882+
struct platform_device *pdev;
1883+
struct device *dev;
1884+
1885+
pdev = of_find_device_by_node(np);
1886+
dev = &pdev->dev;
18811887

1882-
dev = bus_find_device(&spi_bus_type, NULL, np, (void *)of_node_to_dev);
18831888
if (!dev)
1884-
printf("Couldn't find Device\n");
1889+
printk("Couldn't find Device\n");
18851890
return NULL;
18861891

18871892
return container_of(dev, struct spi_master, dev);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy