@@ -2131,17 +2131,29 @@ static void stdout_id_ctrl_apsta(__u8 apsta)
21312131 printf ("\n" );
21322132}
21332133
2134+ static const char * degrees_fahrenheit_str (long t )
2135+ {
2136+ const char * fahrenheit = nvme_degrees_fahrenheit_string (t );
2137+ static char str [STR_LEN ];
2138+
2139+ sprintf (str , "%s%s" , fahrenheit ? ", " : "" , fahrenheit ? fahrenheit : "" );
2140+
2141+ return str ;
2142+ }
2143+
21342144static void stdout_id_ctrl_wctemp (__le16 wctemp )
21352145{
2136- printf (" [15:0] : %s (%u K)\tWarning Composite Temperature Threshold (WCTEMP)\n" ,
2137- nvme_degrees_string (le16_to_cpu (wctemp )), le16_to_cpu (wctemp ));
2146+ printf (" [15:0] : %s (%u K%s)\tWarning Composite Temperature Threshold (WCTEMP)\n" ,
2147+ nvme_degrees_string (le16_to_cpu (wctemp )), le16_to_cpu (wctemp ),
2148+ degrees_fahrenheit_str (le16_to_cpu (wctemp )));
21382149 printf ("\n" );
21392150}
21402151
21412152static void stdout_id_ctrl_cctemp (__le16 cctemp )
21422153{
2143- printf (" [15:0] : %s (%u K)\tCritical Composite Temperature Threshold (CCTEMP)\n" ,
2144- nvme_degrees_string (le16_to_cpu (cctemp )), le16_to_cpu (cctemp ));
2154+ printf (" [15:0] : %s (%u K%s)\tCritical Composite Temperature Threshold (CCTEMP)\n" ,
2155+ nvme_degrees_string (le16_to_cpu (cctemp )), le16_to_cpu (cctemp ),
2156+ degrees_fahrenheit_str (le16_to_cpu (cctemp )));
21452157 printf ("\n" );
21462158}
21472159
@@ -2206,15 +2218,17 @@ static void stdout_id_ctrl_hctma(__le16 ctrl_hctma)
22062218
22072219static void stdout_id_ctrl_mntmt (__le16 mntmt )
22082220{
2209- printf (" [15:0] : %s (%u K)\tMinimum Thermal Management Temperature (MNTMT)\n" ,
2210- nvme_degrees_string (le16_to_cpu (mntmt )), le16_to_cpu (mntmt ));
2221+ printf (" [15:0] : %s (%u K%s)\tMinimum Thermal Management Temperature (MNTMT)\n" ,
2222+ nvme_degrees_string (le16_to_cpu (mntmt )), le16_to_cpu (mntmt ),
2223+ degrees_fahrenheit_str (le16_to_cpu (mntmt )));
22112224 printf ("\n" );
22122225}
22132226
22142227static void stdout_id_ctrl_mxtmt (__le16 mxtmt )
22152228{
2216- printf (" [15:0] : %s (%u K)\tMaximum Thermal Management Temperature (MXTMT)\n" ,
2217- nvme_degrees_string (le16_to_cpu (mxtmt )), le16_to_cpu (mxtmt ));
2229+ printf (" [15:0] : %s (%u K%s)\tMaximum Thermal Management Temperature (MXTMT)\n" ,
2230+ nvme_degrees_string (le16_to_cpu (mxtmt )), le16_to_cpu (mxtmt ),
2231+ degrees_fahrenheit_str (le16_to_cpu (mxtmt )));
22182232 printf ("\n" );
22192233}
22202234
@@ -4394,8 +4408,8 @@ static void stdout_smart_log(struct nvme_smart_log *smart, unsigned int nsid, co
43944408 (smart -> critical_warning & 0x20 ) >> 5 );
43954409 }
43964410
4397- printf ("temperature : %s (%u K)\n" ,
4398- nvme_degrees_string (temperature ), temperature );
4411+ printf ("temperature : %s (%u K%s )\n" ,
4412+ nvme_degrees_string (temperature ), temperature , degrees_fahrenheit_str ( temperature ) );
43994413 printf ("available_spare : %u%%\n" , smart -> avail_spare );
44004414 printf ("available_spare_threshold : %u%%\n" , smart -> spare_thresh );
44014415 printf ("percentage_used : %u%%\n" , smart -> percent_used );
@@ -4431,8 +4445,9 @@ static void stdout_smart_log(struct nvme_smart_log *smart, unsigned int nsid, co
44314445 temperature = le16_to_cpu (smart -> temp_sensor [i ]);
44324446 if (!temperature )
44334447 continue ;
4434- printf ("Temperature Sensor %d : %s (%u K)\n" , i + 1 ,
4435- nvme_degrees_string (temperature ), temperature );
4448+ printf ("Temperature Sensor %d : %s (%u K%s)\n" , i + 1 ,
4449+ nvme_degrees_string (temperature ), temperature ,
4450+ degrees_fahrenheit_str (temperature ));
44364451 }
44374452
44384453 printf ("Thermal Management T1 Trans Count : %u\n" ,
@@ -5033,16 +5048,17 @@ static void stdout_feature_show_fields(enum nvme_features_id fid,
50335048 break ;
50345049 case NVME_FEAT_FID_TEMP_THRESH :
50355050 field = (result & 0x1c00000 ) >> 22 ;
5036- printf ("\tTemperature Threshold Hysteresis(TMPTHH): %s (%u K)\n" ,
5037- nvme_degrees_string (field ), field );
5051+ printf ("\tTemperature Threshold Hysteresis(TMPTHH): %s (%u K%s )\n" ,
5052+ nvme_degrees_string (field ), field , degrees_fahrenheit_str ( field ) );
50385053 field = NVME_FEAT_TT_THSEL (result );
50395054 printf ("\tThreshold Type Select (THSEL): %u - %s\n" , field ,
50405055 nvme_feature_temp_type_to_string (field ));
50415056 field = NVME_FEAT_TT_TMPSEL (result );
50425057 printf ("\tThreshold Temperature Select (TMPSEL): %u - %s\n" ,
50435058 field , nvme_feature_temp_sel_to_string (field ));
5044- printf ("\tTemperature Threshold (TMPTH): %s (%u K)\n" ,
5045- nvme_degrees_string (NVME_FEAT_TT_TMPTH (result )), NVME_FEAT_TT_TMPTH (result ));
5059+ printf ("\tTemperature Threshold (TMPTH): %s (%u K%s)\n" ,
5060+ nvme_degrees_string (NVME_FEAT_TT_TMPTH (result )), NVME_FEAT_TT_TMPTH (result ),
5061+ degrees_fahrenheit_str (NVME_FEAT_TT_TMPTH (result )));
50465062 break ;
50475063 case NVME_FEAT_FID_ERR_RECOVERY :
50485064 printf ("\tDeallocated or Unwritten Logical Block Error Enable (DULBE): %s\n" ,
@@ -5135,12 +5151,14 @@ static void stdout_feature_show_fields(enum nvme_features_id fid,
51355151 printf ("\tKeep Alive Timeout (KATO) in milliseconds: %u\n" , result );
51365152 break ;
51375153 case NVME_FEAT_FID_HCTM :
5138- printf ("\tThermal Management Temperature 1 (TMT1) : %u K (%s)\n" ,
5154+ printf ("\tThermal Management Temperature 1 (TMT1) : %u K (%s%s )\n" ,
51395155 NVME_FEAT_HCTM_TMT1 (result ),
5140- nvme_degrees_string (NVME_FEAT_HCTM_TMT1 (result )));
5141- printf ("\tThermal Management Temperature 2 (TMT2) : %u K (%s)\n" ,
5156+ nvme_degrees_string (NVME_FEAT_HCTM_TMT1 (result )),
5157+ degrees_fahrenheit_str (NVME_FEAT_HCTM_TMT1 (result )));
5158+ printf ("\tThermal Management Temperature 2 (TMT2) : %u K (%s%s)\n" ,
51425159 NVME_FEAT_HCTM_TMT2 (result ),
5143- nvme_degrees_string (NVME_FEAT_HCTM_TMT2 (result )));
5160+ nvme_degrees_string (NVME_FEAT_HCTM_TMT2 (result )),
5161+ degrees_fahrenheit_str (NVME_FEAT_HCTM_TMT2 (result )));
51445162 break ;
51455163 case NVME_FEAT_FID_NOPSC :
51465164 printf ("\tNon-Operational Power State Permissive Mode Enable (NOPPME): %s\n" ,
0 commit comments