pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS


Quantron power button misc patch 20190205
Posted by Anonymous on Tue 5th Feb 2019 11:38
raw | new post

  1. diff --git a/ptxdist/local_src/power-button/power-button.c b/ptxdist/local_src/power-button/power-button.c
  2. index b3f97ec..6756482 100644
  3. --- a/ptxdist/local_src/power-button/power-button.c
  4. +++ b/ptxdist/local_src/power-button/power-button.c
  5. @@ -81,7 +81,7 @@ static struct task_struct* pb_thr;
  6.  static int _exit=0;
  7.  
  8.  static const char * const * shutdown_argv[] =
  9. -    { "/sbin/reboot", "--reboot", NULL };
  10. +    { "/sbin/reboot", "--poweroff", NULL };
  11.  
  12.  
  13.  
  14. @@ -94,7 +94,7 @@ static int pb_fkt (void* data)
  15.  
  16.      if (dev == NULL)
  17.      {
  18. -        printk(KERN_INFO "No device in kthread,\n");
  19. +        (void)printk(KERN_INFO "pb_fkt(): No device in kthread,\n");
  20.          return 0;
  21.      }
  22.  
  23. @@ -129,6 +129,7 @@ static int pb_fkt (void* data)
  24.  
  25.                    // Leite Power-Off Sequenz ein.
  26.                    power_off = 1;
  27. +                 (void)printk (KERN_ERR "pb_fkt(): starting power-down sequence...\n");
  28.                    call_usermodehelper(shutdown_argv[0], shutdown_argv, NULL, UMH_NO_WAIT);
  29.                }
  30.                else
  31. @@ -141,6 +142,8 @@ static int pb_fkt (void* data)
  32.                      counter = 0;
  33.                      init_completion(&dev->pb_pressed);
  34.                      enable_irq(dev->IRQ);
  35. +                  
  36. +                   (void)printk (KERN_ERR "pb_fkt(): power-button lockup error\n");
  37.                   }
  38.                }
  39.             }
  40. @@ -151,14 +154,16 @@ static int pb_fkt (void* data)
  41.             msleep(10000);
  42.  
  43.             // Immer noch am Leben. Schlecht.
  44. +          (void)printk (KERN_ERR "pb_fkt(): power-off sequence started, but still alive. BAD.\n");
  45.             power_off = 0;
  46. +
  47.             // Muss nicht, nur zur Sicherheit: http://www.makelinux.net/ldd3/chp-5-sect-4
  48.             init_completion(&dev->pb_pressed);
  49.             enable_irq(dev->IRQ);
  50.          }
  51.      }
  52.  
  53. -    printk(KERN_INFO "kthread stopped.\n");
  54. +    (void)printk(KERN_INFO "pb_fkt(): kthread stopped.\n");
  55.  
  56.      return 0;
  57.  }
  58. @@ -304,7 +309,7 @@ static long pb_driver_ioctl(struct file *filp, unsigned int cmd, unsigned long a
  59.        /*************************************************************************/
  60.  
  61.           /* Fehler innerhalb der Parameterliste */
  62. -         printk(KERN_INFO"unknown PB_IOC 0x%x\n", cmd);
  63. +         (void)printk(KERN_INFO "pb_driver_ioctl(): unknown PB_IOC 0x%x\n", cmd);
  64.           return -EINVAL;
  65.  
  66.        }        break;
  67. @@ -329,14 +334,14 @@ static int __init powerbutton_init(void)
  68.      powerbutton_device.dev = MKDEV(264, 0);
  69.      if ((ret = register_chrdev_region(powerbutton_device.dev, 1, "powerbutton")) < 0)
  70.      {
  71. -        printk(KERN_ERR "powerbutton_init(): register_chrdev_region(): ret=%d\n", ret);
  72. +        (void)printk(KERN_ERR "powerbutton_init(): register_chrdev_region(): ret=%d\n", ret);
  73.          goto out;
  74.      }
  75.  
  76.      cdev_init(&powerbutton_device.cdev, &powerbutton_fops);
  77.      if ((ret = cdev_add(&powerbutton_device.cdev, powerbutton_device.dev, 1)) < 0)
  78.      {
  79. -        printk(KERN_ERR "could not allocate powerbutton\n");
  80. +        (void)printk(KERN_ERR "powerbutton_init(): could not allocate powerbutton\n");
  81.          goto out_unalloc_region;
  82.      }
  83.  
  84. @@ -344,14 +349,14 @@ static int __init powerbutton_init(void)
  85.      powerbutton_device.IRQ = gpio_to_irq(powerbutton_device.pb_pin);
  86.      if ((ret = request_irq(powerbutton_device.IRQ, pb_isr, IRQF_SHARED, "powerbutton", &powerbutton_device )) < 0)
  87.      {
  88. -        printk(KERN_ERR "cannot register IRQ %d\n", PB_IRQNR);
  89. +        (void)printk(KERN_ERR "powerbutton_init(): cannot register IRQ %d\n", PB_IRQNR);
  90.          goto out_irq;
  91.      }
  92.      //set_irq_type(powerbutton_device.IRQ, IRQ_TYPE_EDGE_RISING);
  93.  
  94.      if ((ret = gpio_request(powerbutton_device.pb_pin, "powerbutton")) < 0)
  95.      {
  96. -        printk(KERN_ERR "cannor request gpio %d\n", PB_PIN);
  97. +        (void)printk(KERN_ERR "powerbutton_init(): cannot request gpio %d\n", PB_PIN);
  98.          goto out_gpio_pb;
  99.      }
  100.      gpio_direction_input(powerbutton_device.pb_pin);
  101. @@ -360,7 +365,7 @@ static int __init powerbutton_init(void)
  102.      //GPIO Shutdown
  103.      if ((ret = gpio_request(powerbutton_device.shutdown_pin, "shutdown")) < 0)
  104.      {
  105. -        printk(KERN_ERR "cannto request gpio %d\n", SHUTDOWN_PIN);
  106. +        (void)printk(KERN_ERR "powerbutton_init(): cannot request gpio %d\n", SHUTDOWN_PIN);
  107.          goto out_gpio_shutdown;
  108.      }
  109.      gpio_direction_output(powerbutton_device.shutdown_pin, 1);
  110. @@ -370,7 +375,7 @@ static int __init powerbutton_init(void)
  111.  
  112.      powerbutton_device.virt_adr = ioremap( powerbutton_device.PHY_ADR, powerbutton_device.PHY_LEN );
  113.      if( NULL == powerbutton_device.virt_adr ){
  114. -        printk (KERN_WARNING "powerbutton_init: err: %d()\n", PTR_ERR(powerbutton_device.virt_adr));
  115. +        (void)printk (KERN_WARNING "powerbutton_init(): err: %d()\n", PTR_ERR(powerbutton_device.virt_adr));
  116.          goto out_memory;
  117.      }
  118.      else {
  119. @@ -381,7 +386,7 @@ static int __init powerbutton_init(void)
  120.      pb_thr = kthread_run (pb_fkt, &powerbutton_device, "pb-thread");
  121.      if (IS_ERR(pb_thr))
  122.      {
  123. -        printk (KERN_WARNING "powerbutton_init: err: %d()\n", PTR_ERR(pb_thr));
  124. +        (void)printk (KERN_WARNING "powerbutton_init(): err: %d()\n", PTR_ERR(pb_thr));
  125.          goto out_kthread;
  126.  
  127.      }
  128. @@ -425,6 +430,6 @@ static void __exit powerbutton_exit(void)
  129.  module_init(powerbutton_init);
  130.  module_exit(powerbutton_exit);
  131.  
  132. -MODULE_DESCRIPTION("device driver for power button");
  133. +MODULE_DESCRIPTION("device driver for Quantron power button");
  134.  MODULE_LICENSE("Dual BSD/GPL");

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at