ibmasm.h (39fe5434cb9de5da40510028b17b96bc4eb312b3) | ibmasm.h (a045171f875cd61f690981a78ab98fbd137c938b) |
---|---|
1 2/* 3 * IBM ASM Service Processor Device Driver 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 17 unchanged lines hidden (view full) --- 26#include <linux/types.h> 27#include <linux/errno.h> 28#include <linux/list.h> 29#include <linux/wait.h> 30#include <linux/spinlock.h> 31#include <linux/slab.h> 32#include <linux/module.h> 33#include <linux/interrupt.h> | 1 2/* 3 * IBM ASM Service Processor Device Driver 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 17 unchanged lines hidden (view full) --- 26#include <linux/types.h> 27#include <linux/errno.h> 28#include <linux/list.h> 29#include <linux/wait.h> 30#include <linux/spinlock.h> 31#include <linux/slab.h> 32#include <linux/module.h> 33#include <linux/interrupt.h> |
34#include <linux/kref.h> |
|
34#include <linux/device.h> 35#include <linux/input.h> 36 37/* Driver identification */ 38#define DRIVER_NAME "ibmasm" 39#define DRIVER_VERSION "1.0" 40#define DRIVER_AUTHOR "Max Asbock <masbock@us.ibm.com>, Vernon Mauery <vernux@us.ibm.com>" 41#define DRIVER_DESC "IBM ASM Service Processor Driver" --- 45 unchanged lines hidden (view full) --- 87 88 89struct command { 90 struct list_head queue_node; 91 wait_queue_head_t wait; 92 unsigned char *buffer; 93 size_t buffer_size; 94 int status; | 35#include <linux/device.h> 36#include <linux/input.h> 37 38/* Driver identification */ 39#define DRIVER_NAME "ibmasm" 40#define DRIVER_VERSION "1.0" 41#define DRIVER_AUTHOR "Max Asbock <masbock@us.ibm.com>, Vernon Mauery <vernux@us.ibm.com>" 42#define DRIVER_DESC "IBM ASM Service Processor Driver" --- 45 unchanged lines hidden (view full) --- 88 89 90struct command { 91 struct list_head queue_node; 92 wait_queue_head_t wait; 93 unsigned char *buffer; 94 size_t buffer_size; 95 int status; |
95 struct kobject kobj; | 96 struct kref kref; |
96 spinlock_t *lock; 97}; | 97 spinlock_t *lock; 98}; |
98#define to_command(c) container_of(c, struct command, kobj) | 99#define to_command(c) container_of(c, struct command, kref) |
99 | 100 |
101void ibmasm_free_command(struct kref *kref); |
|
100static inline void command_put(struct command *cmd) 101{ 102 unsigned long flags; 103 spinlock_t *lock = cmd->lock; 104 105 spin_lock_irqsave(lock, flags); | 102static inline void command_put(struct command *cmd) 103{ 104 unsigned long flags; 105 spinlock_t *lock = cmd->lock; 106 107 spin_lock_irqsave(lock, flags); |
106 kobject_put(&cmd->kobj); | 108 kref_put(&cmd->kref, ibmasm_free_command); |
107 spin_unlock_irqrestore(lock, flags); 108} 109 110static inline void command_get(struct command *cmd) 111{ | 109 spin_unlock_irqrestore(lock, flags); 110} 111 112static inline void command_get(struct command *cmd) 113{ |
112 kobject_get(&cmd->kobj); | 114 kref_get(&cmd->kref); |
113} 114 115 116struct ibmasm_event { 117 unsigned int serial_number; 118 unsigned int data_size; 119 unsigned char data[IBMASM_EVENT_MAX_SIZE]; 120}; --- 98 unchanged lines hidden --- | 115} 116 117 118struct ibmasm_event { 119 unsigned int serial_number; 120 unsigned int data_size; 121 unsigned char data[IBMASM_EVENT_MAX_SIZE]; 122}; --- 98 unchanged lines hidden --- |