require '_h2ph_pre.ph';

unless(defined(&I2C_H)) {
    eval 'sub I2C_H () {1;}' unless defined(&I2C_H);
    require 'linux/version.ph';
    eval 'sub I2C_BUS_MAX () {4;}' unless defined(&I2C_BUS_MAX);
    eval 'sub I2C_DRIVER_MAX () {8;}' unless defined(&I2C_DRIVER_MAX);
    eval 'sub I2C_DEVICE_MAX () {8;}' unless defined(&I2C_DEVICE_MAX);
    eval 'sub I2C_DRIVERID_MSP3400 () {1;}' unless defined(&I2C_DRIVERID_MSP3400);
    eval 'sub I2C_DRIVERID_TUNER () {2;}' unless defined(&I2C_DRIVERID_TUNER);
    eval 'sub I2C_DRIVERID_VIDEOTEXT () {3;}' unless defined(&I2C_DRIVERID_VIDEOTEXT);
    eval 'sub I2C_DRIVERID_VIDEODECODER () {4;}' unless defined(&I2C_DRIVERID_VIDEODECODER);
    eval 'sub I2C_DRIVERID_VIDEOENCODER () {5;}' unless defined(&I2C_DRIVERID_VIDEOENCODER);
    eval 'sub I2C_BUSID_BT848 () {1;}' unless defined(&I2C_BUSID_BT848);
    eval 'sub I2C_BUSID_PARPORT () {2;}' unless defined(&I2C_BUSID_PARPORT);
    eval 'sub I2C_BUSID_BUZ () {3;}' unless defined(&I2C_BUSID_BUZ);
    eval 'sub I2C_BUSID_ZORAN () {4;}' unless defined(&I2C_BUSID_ZORAN);
    eval 'sub I2C_BUSID_CYBER2000 () {5;}' unless defined(&I2C_BUSID_CYBER2000);
    if((defined(&LINUX_VERSION_CODE) ? &LINUX_VERSION_CODE : 0) >= 0x20100) {
	if(0) {
	    eval 'sub LOCK_FLAGS () {\'unsigned long flags\';;}' unless defined(&LOCK_FLAGS);
	    eval 'sub LOCK_I2C_BUS {
	        local($bus) = @_;
    		eval q( &spin_lock_irqsave(( ($bus->{bus_lock})), &flags););
	    }' unless defined(&LOCK_I2C_BUS);
	    eval 'sub UNLOCK_I2C_BUS {
	        local($bus) = @_;
    		eval q( &spin_unlock_irqrestore(( ($bus->{bus_lock})), &flags););
	    }' unless defined(&UNLOCK_I2C_BUS);
	} else {
	    eval 'sub LOCK_FLAGS () {1;}' unless defined(&LOCK_FLAGS);
	    eval 'sub LOCK_I2C_BUS {
	        local($bus) = @_;
    		eval q( &spin_lock(( ($bus->{bus_lock}))););
	    }' unless defined(&LOCK_I2C_BUS);
	    eval 'sub UNLOCK_I2C_BUS {
	        local($bus) = @_;
    		eval q( &spin_unlock(( ($bus->{bus_lock}))););
	    }' unless defined(&UNLOCK_I2C_BUS);
	}
    } else {
	eval 'sub LOCK_FLAGS () {\'unsigned long flags\';;}' unless defined(&LOCK_FLAGS);
	eval 'sub LOCK_I2C_BUS {
	    local($bus) = @_;
    	    eval q({  &save_flags( &flags);  &cli(); });
	}' unless defined(&LOCK_I2C_BUS);
	eval 'sub UNLOCK_I2C_BUS {
	    local($bus) = @_;
    	    eval q({  &restore_flags( &flags); });
	}' unless defined(&UNLOCK_I2C_BUS);
    }
    if((defined(&LINUX_VERSION_CODE) ? &LINUX_VERSION_CODE : 0) >= 0x20100) {
    }
}
1;
