Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8521365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:48:13+00:00 2026-06-11T06:48:13+00:00

I am writing a driver for the GPIO pins on an ARM platform. My

  • 0

I am writing a driver for the GPIO pins on an ARM platform.
My driver works correctly and I’ve avoided the problem until
now by manually mknod’ing a device file.

my initialization code:


static int __init gpio_init (void)
{

    void *ptr_error;
    if (register_chrdev(249, "gpio_device", &fops) < 0){
            printk(KERN_INFO "Registering device failed\n");
            return -EINVAL;
    }

    if ((device_class = class_create(THIS_MODULE, "gpio_device"))
                                                    == NULL){
            unregister_chrdev_region(DEV_T, 1);
            printk(KERN_INFO "Class creation failed\n");
            return -EINVAL;
    }
    ptr_error = device_create(device_class, NULL, DEV_T, NULL, "gpio_device");
    if (IS_ERR(ptr_error)){
            class_destroy(device_class);
            unregister_chrdev_region(DEV_T, 1);
            printk(KERN_INFO "Device creation failed\n");
            return -EINVAL;
    }

    cdev_init(&c_dev, &fops);

    if (cdev_add(&c_dev, DEV_T, 1)){
            device_destroy(device_class, DEV_T);
            class_destroy(device_class);
            unregister_chrdev_region(DEV_T, 1);
            printk(KERN_INFO "Cdev add failed\n");
            return -EINVAL;
    }
    printk(KERN_INFO "Guten tag, GPIO driver initialized\n");
    return SUCCESS;

}

This runs with no errors, except no file “gpio_device” is created in /dev.

I’m cross compiling for ARM onto kernel 2.6.39.4. (using arm-linux-gcc)

As I understand it, device_create should be creating the /dev file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:48:15+00:00Added an answer on June 11, 2026 at 6:48 am

    I just figured out what was going on here.
    We are using BuildRoot to create our custom
    linux, and the it turns out we had compiled
    out the udev device file management system.

    So that’s why this doesn’t work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Python extension for the functions provided by a GPIO driver. I
Where can i find information on writing a vga driver? The target platform is
we're writing an open-source jdbc driver for bigquery, and ran into the following problem:
I am writing a Linux Kernel driver ( for ARM ) and in an
I wrote a char device driver and am now writing a QT wrapper which
I'm writing a RS485 driver for an ARM AT91SAM9260 board on Linux. When I
I'm writing a driver that requires me to clear all the memory allocated to
I am quite new to Selenium. Currently i am using selenium driver for writing
I'm writing to a user-space buffer from a kernel-level driver (from the IOControl functionality)
Hi I'm writing a write() method for my character driver and I was wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.