acpi_button_remove_fs(device); 
acpi_button_add (	struct acpi_device	*device){	int			result = 0;	acpi_status		status = AE_OK;	struct acpi_button	*button = NULL;	static struct acpi_device *power_button;	static struct acpi_device *sleep_button;	static struct acpi_device *lid_button;	ACPI_FUNCTION_TRACE("acpi_button_add");	if (!device)		return_VALUE(-EINVAL);	button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL);	if (!button)		return_VALUE(-ENOMEM);	memset(button, 0, sizeof(struct acpi_button));	button->device = device;	button->handle = device->handle;	acpi_driver_data(device) = button;	/*	 * Determine the button type (via hid), as fixed-feature buttons	 * need to be handled a bit differently than generic-space.	 */	if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {		button->type = ACPI_BUTTON_TYPE_POWER;		strcpy(acpi_device_name(device),			ACPI_BUTTON_DEVICE_NAME_POWER);		sprintf(acpi_device_class(device), "%s/%s", 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);	}	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {		button->type = ACPI_BUTTON_TYPE_POWERF;		strcpy(acpi_device_name(device),			ACPI_BUTTON_DEVICE_NAME_POWERF);		sprintf(acpi_device_class(device), "%s/%s", 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);	}	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {		button->type = ACPI_BUTTON_TYPE_SLEEP;		strcpy(acpi_device_name(device),			ACPI_BUTTON_DEVICE_NAME_SLEEP);		sprintf(acpi_device_class(device), "%s/%s", 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);	}	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {		button->type = ACPI_BUTTON_TYPE_SLEEPF;		strcpy(acpi_device_name(device),			ACPI_BUTTON_DEVICE_NAME_SLEEPF);		sprintf(acpi_device_class(device), "%s/%s", 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);	}	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {		button->type = ACPI_BUTTON_TYPE_LID;		strcpy(acpi_device_name(device),			ACPI_BUTTON_DEVICE_NAME_LID);		sprintf(acpi_device_class(device), "%s/%s", 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);	}	else {		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n",			acpi_device_hid(device)));		result = -ENODEV;		goto end;	}	/*	 * Ensure only one button of each type is used.	 */	switch (button->type) {	case ACPI_BUTTON_TYPE_POWER:	case ACPI_BUTTON_TYPE_POWERF:		if (!power_button)			power_button = device;		else {			kfree(button);			return_VALUE(-ENODEV);		}		break;	case ACPI_BUTTON_TYPE_SLEEP:	case ACPI_BUTTON_TYPE_SLEEPF:		if (!sleep_button)			sleep_button = device;		else {			kfree(button);			return_VALUE(-ENODEV);		}		break;	case ACPI_BUTTON_TYPE_LID:		if (!lid_button)			lid_button = device;		else {			kfree(button);			return_VALUE(-ENODEV);		}		break;	}	result = acpi_button_add_fs(device);	if (result)		goto end;	switch (button->type) {	case ACPI_BUTTON_TYPE_POWERF:		status = acpi_install_fixed_event_handler (			ACPI_EVENT_POWER_BUTTON,			acpi_button_notify_fixed,			button);		break;	case ACPI_BUTTON_TYPE_SLEEPF:		status = acpi_install_fixed_event_handler (			ACPI_EVENT_SLEEP_BUTTON,			acpi_button_notify_fixed,			button);		break;	default:		status = acpi_install_notify_handler (			button->handle,			ACPI_DEVICE_NOTIFY,			acpi_button_notify,			button);		break;	}	if (ACPI_FAILURE(status)) {		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,			"Error installing notify handler\n"));		result = -ENODEV;		goto end;	}	if (device->wakeup.flags.valid) {		/* Button's GPE is run-wake GPE */		acpi_set_gpe_type(device->wakeup.gpe_device, 			device->wakeup.gpe_number, ACPI_GPE_TYPE_WAKE_RUN);		acpi_enable_gpe(device->wakeup.gpe_device, 			device->wakeup.gpe_number, ACPI_NOT_ISR);		device->wakeup.state.enabled = 1;	}	printk(KERN_INFO PREFIX "%s [%s]\n", 		acpi_device_name(device), acpi_device_bid(device));end:	if (result) {		acpi_button_remove_fs(device);		kfree(button);	}	return_VALUE(result);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/bd4698dad3023ae137b366c736e29ca6eaf3b9f7/button.c/buggy/drivers/acpi/button.c