Skip to content

Commit 1a1e08f

Browse files
authored
Merge pull request #12 from AtsushiSaito/fix_null_pointer_problem
Modify execution timing of iounmap
2 parents 4844ee2 + 5072b15 commit 1a1e08f

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

src/drivers/rtmouse.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ static volatile void __iomem *clk_base;
130130
static volatile uint32_t *gpio_base;
131131

132132
static volatile int cdev_index = 0;
133-
static volatile int open_counter = 0;
134133

135134
static struct mutex lock;
136135

@@ -751,36 +750,23 @@ static int gpio_unmap(void)
751750
/* Open Device */
752751
static int dev_open(struct inode *inode, struct file *filep)
753752
{
754-
int retval;
755753
int *minor = (int *)kmalloc(sizeof(int), GFP_KERNEL);
756754
int major = MAJOR(inode->i_rdev);
757755
*minor = MINOR(inode->i_rdev);
758756

759757
filep->private_data = (void *)minor;
760758

761-
retval = gpio_map();
762-
if (retval != 0) {
763-
printk(KERN_ERR "Can not use GPIO registers.\n");
764-
return retval;
765-
}
766-
767759
if (_major_motor == major) {
768760
printk(KERN_INFO "motor write\n");
769761
}
770762

771-
open_counter++;
772763
return 0;
773764
}
774765

775766
/* Close device */
776767
static int dev_release(struct inode *inode, struct file *filep)
777768
{
778769
kfree(filep->private_data);
779-
780-
open_counter--;
781-
if (open_counter <= 0) {
782-
gpio_unmap();
783-
}
784770
return 0;
785771
}
786772

@@ -2099,9 +2085,6 @@ int dev_init_module(void)
20992085
rpi_gpio_clear32(RPI_GPIO_P2MASK, 1 << RF_LED_BASE);
21002086
rpi_gpio_clear32(RPI_GPIO_P2MASK, 1 << LF_LED_BASE);
21012087

2102-
/* GPIOレジスタのアンマップ */
2103-
gpio_unmap();
2104-
21052088
// printk(KERN_DEBUG "%s: gpio initialized\n", __func__);
21062089

21072090
/* cdev構造体の用意 */
@@ -2253,6 +2236,7 @@ void dev_cleanup_module(void)
22532236

22542237
/* free cdev memory */
22552238
kfree(cdev_array);
2239+
gpio_unmap();
22562240
printk(KERN_INFO "%s: module removed at %lu\n", DRIVER_NAME, jiffies);
22572241
}
22582242

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