FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_check_fw_version - check if the FW is compatible with this driver
 *	@adapter: the adapter
 *
 *	Checks if an adapter's FW is compatible with the driver.  Returns 0
 *	if the versions are compatible, a negative error otherwise.
 */
check if the FW is compatible with this driver
@adapter: the adapter

Checks if an adapter's FW is compatible with the driver.  Returns 0
if the versions are compatible, a negative error otherwise.
check if the FW is compatible with this driver @adapter : the adapter Checks if an adapter ' s FW is compatible with the driver . Returns 0 if the versions are compatible a negative error otherwise .
int t3_check_fw_version(adapter_t *adapter)
{
	int ret;
	u32 vers;
	unsigned int type, major, minor;
	ret = t3_get_fw_version(adapter, &vers);
	if (ret)
		return ret;
	type = G_FW_VERSION_TYPE(vers);
	major = G_FW_VERSION_MAJOR(vers);
	minor = G_FW_VERSION_MINOR(vers);
	if (type == FW_VERSION_T3 && major == FW_VERSION_MAJOR &&
	    minor == FW_VERSION_MINOR)
		return 0;
	else if (major != FW_VERSION_MAJOR || minor < FW_VERSION_MINOR)
		CH_WARN(adapter, "found old FW minor version(%u.%u), "
		        "driver compiled for version %u.%u\n", major, minor,
			FW_VERSION_MAJOR, FW_VERSION_MINOR);
	else {
		CH_WARN(adapter, "found newer FW version(%u.%u), "
		        "driver compiled for version %u.%u\n", major, minor,
			FW_VERSION_MAJOR, FW_VERSION_MINOR);
			return 0;
	}
	return -EINVAL;
}
int t3_check_fw_version ( adapter_t * adapter ) { int ret ; u32 vers ; unsigned int type , major , minor ; ret = t3_get_fw_version ( adapter , & vers ) ; if ( ret ) return ret ; type = G_FW_VERSION_TYPE ( vers ) ; major = G_FW_VERSION_MAJOR ( vers ) ; minor = G_FW_VERSION_MINOR ( vers ) ; if ( type == FW_VERSION_T3 && major == FW_VERSION_MAJOR && minor == FW_VERSION_MINOR ) return 0 ; else if ( major != FW_VERSION_MAJOR || minor < FW_VERSION_MINOR ) CH_WARN ( adapter , " " " \n " , major , minor , FW_VERSION_MAJOR , FW_VERSION_MINOR ) ; else { CH_WARN ( adapter , " " " \n " , major , minor , FW_VERSION_MAJOR , FW_VERSION_MINOR ) ; return 0 ; } return - EINVAL ; }
t3_check_fw_version - check if the FW is compatible with this driver
      @adapter: the adapter
t3_check_fw_version - check if the FW is compatible with this driver @adapter : the adapter