static void cyasdevice_deinit(cyasdevice *cy_as_dev)
{
	cy_as_hal_print_message("<1>_cy_as_device deinitialize called\n");
	if (!cy_as_dev) {
		cy_as_hal_print_message("<1>_cy_as_device_deinit:  "
			"device handle %x is invalid\n", (uint32_t)cy_as_dev);
		return;
	}

	/* stop west_brige */
	if (cy_as_dev->dev_handle) {
		cy_as_hal_print_message("<1>_cy_as_device: "
			"cy_as_misc_destroy_device called\n");
		if (cy_as_misc_destroy_device(cy_as_dev->dev_handle) !=
			CY_AS_ERROR_SUCCESS) {
			cy_as_hal_print_message(
				"<1>_cy_as_device: destroying failed\n");
		}
	}

	if (cy_as_dev->hal_tag) {

 #ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
		if (stop_o_m_a_p_kernel(dev_handle_name,
			cy_as_dev->hal_tag) != 0)
			cy_as_hal_print_message("<1>_cy_as_device: stopping "
				"OMAP kernel HAL failed\n");

 #endif
#ifdef CONFIG_MACH_C110_WESTBRIDGE_AST_PNAND_HAL
		if (cy_as_hal_c110_pnand_stop(dev_handle_name,	cy_as_dev->hal_tag) != 0)
			cy_as_hal_print_message("<1>_cy_as_device: stopping C110 CRAM HAL failed\n");
#endif

	}
	cy_as_hal_print_message("<1>_cy_as_device:HAL layer stopped\n");

	if (cy_as_dev->f_platform_driver) {
		cy_as_hal_print_message("<1>_cy_as_device: remove cyas_diagnostics\n") ;
		#ifdef __CYAS_SYSFS_FOR_DIAGNOSTICS__
		device_remove_file(&westbridge_pd->dev, &dev_attr_cyas_diagnostics);
		device_remove_file(&westbridge_pd->dev, &dev_attr_serial);
		device_remove_file(&westbridge_pd->dev, &dev_attr_wbcid);
		#endif

		cy_as_hal_print_message("<1>_cy_as_device: unregister west_bridge_driver\n") ;
		platform_driver_unregister(&west_bridge_driver);
	}

	kfree(cy_as_dev);
	cy_as_device_controller = NULL;
	cy_as_hal_print_message("<1>_cy_as_device: deinitialized\n");
}
Exemple #2
0
static void cyasdevice_deinit(cyasdevice *cy_as_dev)
{
    cy_as_hal_print_message("<1>_cy_as_device deinitialize called\n");
    if (!cy_as_dev) {
        cy_as_hal_print_message("<1>_cy_as_device_deinit:  "
                                "device handle %x is invalid\n", (uint32_t)cy_as_dev);
        return;
    }

    /* stop west_brige */
    if (cy_as_dev->dev_handle) {
        cy_as_hal_print_message("<1>_cy_as_device: "
                                "cy_as_misc_destroy_device called\n");
        if (cy_as_misc_destroy_device(cy_as_dev->dev_handle) !=
                CY_AS_ERROR_SUCCESS) {
            cy_as_hal_print_message(
                "<1>_cy_as_device: destroying failed\n");
        }
    }

    if (cy_as_dev->hal_tag) {

#ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
        if (stop_o_m_a_p_kernel(dev_handle_name,
                                cy_as_dev->hal_tag) != 0)
            cy_as_hal_print_message("<1>_cy_as_device: stopping "
                                    "OMAP kernel HAL failed\n");

#endif
    }
    cy_as_hal_print_message("<1>_cy_as_device:HAL layer stopped\n");

    kfree(cy_as_dev);
    cy_as_device_controller = NULL;
    cy_as_hal_print_message("<1>_cy_as_device: deinitialized\n");
}