@@ -2125,19 +2125,16 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
2125
2125
2126
2126
static int ata_log_supported (struct ata_device * dev , u8 log )
2127
2127
{
2128
- struct ata_port * ap = dev -> link -> ap ;
2129
-
2130
2128
if (dev -> quirks & ATA_QUIRK_NO_LOG_DIR )
2131
2129
return 0 ;
2132
2130
2133
- if (ata_read_log_page (dev , ATA_LOG_DIRECTORY , 0 , ap -> sector_buf , 1 ))
2131
+ if (ata_read_log_page (dev , ATA_LOG_DIRECTORY , 0 , dev -> sector_buf , 1 ))
2134
2132
return 0 ;
2135
- return get_unaligned_le16 (& ap -> sector_buf [log * 2 ]);
2133
+ return get_unaligned_le16 (& dev -> sector_buf [log * 2 ]);
2136
2134
}
2137
2135
2138
2136
static bool ata_identify_page_supported (struct ata_device * dev , u8 page )
2139
2137
{
2140
- struct ata_port * ap = dev -> link -> ap ;
2141
2138
unsigned int err , i ;
2142
2139
2143
2140
if (dev -> quirks & ATA_QUIRK_NO_ID_DEV_LOG )
@@ -2160,13 +2157,13 @@ static bool ata_identify_page_supported(struct ata_device *dev, u8 page)
2160
2157
* Read IDENTIFY DEVICE data log, page 0, to figure out if the page is
2161
2158
* supported.
2162
2159
*/
2163
- err = ata_read_log_page (dev , ATA_LOG_IDENTIFY_DEVICE , 0 , ap -> sector_buf ,
2164
- 1 );
2160
+ err = ata_read_log_page (dev , ATA_LOG_IDENTIFY_DEVICE , 0 ,
2161
+ dev -> sector_buf , 1 );
2165
2162
if (err )
2166
2163
return false;
2167
2164
2168
- for (i = 0 ; i < ap -> sector_buf [8 ]; i ++ ) {
2169
- if (ap -> sector_buf [9 + i ] == page )
2165
+ for (i = 0 ; i < dev -> sector_buf [8 ]; i ++ ) {
2166
+ if (dev -> sector_buf [9 + i ] == page )
2170
2167
return true;
2171
2168
}
2172
2169
@@ -2218,20 +2215,19 @@ static inline bool ata_dev_knobble(struct ata_device *dev)
2218
2215
2219
2216
static void ata_dev_config_ncq_send_recv (struct ata_device * dev )
2220
2217
{
2221
- struct ata_port * ap = dev -> link -> ap ;
2222
2218
unsigned int err_mask ;
2223
2219
2224
2220
if (!ata_log_supported (dev , ATA_LOG_NCQ_SEND_RECV )) {
2225
2221
ata_dev_warn (dev , "NCQ Send/Recv Log not supported\n" );
2226
2222
return ;
2227
2223
}
2228
2224
err_mask = ata_read_log_page (dev , ATA_LOG_NCQ_SEND_RECV ,
2229
- 0 , ap -> sector_buf , 1 );
2225
+ 0 , dev -> sector_buf , 1 );
2230
2226
if (!err_mask ) {
2231
2227
u8 * cmds = dev -> ncq_send_recv_cmds ;
2232
2228
2233
2229
dev -> flags |= ATA_DFLAG_NCQ_SEND_RECV ;
2234
- memcpy (cmds , ap -> sector_buf , ATA_LOG_NCQ_SEND_RECV_SIZE );
2230
+ memcpy (cmds , dev -> sector_buf , ATA_LOG_NCQ_SEND_RECV_SIZE );
2235
2231
2236
2232
if (dev -> quirks & ATA_QUIRK_NO_NCQ_TRIM ) {
2237
2233
ata_dev_dbg (dev , "disabling queued TRIM support\n" );
@@ -2243,7 +2239,6 @@ static void ata_dev_config_ncq_send_recv(struct ata_device *dev)
2243
2239
2244
2240
static void ata_dev_config_ncq_non_data (struct ata_device * dev )
2245
2241
{
2246
- struct ata_port * ap = dev -> link -> ap ;
2247
2242
unsigned int err_mask ;
2248
2243
2249
2244
if (!ata_log_supported (dev , ATA_LOG_NCQ_NON_DATA )) {
@@ -2252,17 +2247,14 @@ static void ata_dev_config_ncq_non_data(struct ata_device *dev)
2252
2247
return ;
2253
2248
}
2254
2249
err_mask = ata_read_log_page (dev , ATA_LOG_NCQ_NON_DATA ,
2255
- 0 , ap -> sector_buf , 1 );
2256
- if (!err_mask ) {
2257
- u8 * cmds = dev -> ncq_non_data_cmds ;
2258
-
2259
- memcpy (cmds , ap -> sector_buf , ATA_LOG_NCQ_NON_DATA_SIZE );
2260
- }
2250
+ 0 , dev -> sector_buf , 1 );
2251
+ if (!err_mask )
2252
+ memcpy (dev -> ncq_non_data_cmds , dev -> sector_buf ,
2253
+ ATA_LOG_NCQ_NON_DATA_SIZE );
2261
2254
}
2262
2255
2263
2256
static void ata_dev_config_ncq_prio (struct ata_device * dev )
2264
2257
{
2265
- struct ata_port * ap = dev -> link -> ap ;
2266
2258
unsigned int err_mask ;
2267
2259
2268
2260
if (!ata_identify_page_supported (dev , ATA_LOG_SATA_SETTINGS ))
@@ -2271,12 +2263,11 @@ static void ata_dev_config_ncq_prio(struct ata_device *dev)
2271
2263
err_mask = ata_read_log_page (dev ,
2272
2264
ATA_LOG_IDENTIFY_DEVICE ,
2273
2265
ATA_LOG_SATA_SETTINGS ,
2274
- ap -> sector_buf ,
2275
- 1 );
2266
+ dev -> sector_buf , 1 );
2276
2267
if (err_mask )
2277
2268
goto not_supported ;
2278
2269
2279
- if (!(ap -> sector_buf [ATA_LOG_NCQ_PRIO_OFFSET ] & BIT (3 )))
2270
+ if (!(dev -> sector_buf [ATA_LOG_NCQ_PRIO_OFFSET ] & BIT (3 )))
2280
2271
goto not_supported ;
2281
2272
2282
2273
dev -> flags |= ATA_DFLAG_NCQ_PRIO ;
@@ -2392,9 +2383,8 @@ static void ata_dev_config_sense_reporting(struct ata_device *dev)
2392
2383
2393
2384
static void ata_dev_config_zac (struct ata_device * dev )
2394
2385
{
2395
- struct ata_port * ap = dev -> link -> ap ;
2396
2386
unsigned int err_mask ;
2397
- u8 * identify_buf = ap -> sector_buf ;
2387
+ u8 * identify_buf = dev -> sector_buf ;
2398
2388
2399
2389
dev -> zac_zones_optimal_open = U32_MAX ;
2400
2390
dev -> zac_zones_optimal_nonseq = U32_MAX ;
@@ -2446,7 +2436,6 @@ static void ata_dev_config_zac(struct ata_device *dev)
2446
2436
2447
2437
static void ata_dev_config_trusted (struct ata_device * dev )
2448
2438
{
2449
- struct ata_port * ap = dev -> link -> ap ;
2450
2439
u64 trusted_cap ;
2451
2440
unsigned int err ;
2452
2441
@@ -2460,11 +2449,11 @@ static void ata_dev_config_trusted(struct ata_device *dev)
2460
2449
}
2461
2450
2462
2451
err = ata_read_log_page (dev , ATA_LOG_IDENTIFY_DEVICE , ATA_LOG_SECURITY ,
2463
- ap -> sector_buf , 1 );
2452
+ dev -> sector_buf , 1 );
2464
2453
if (err )
2465
2454
return ;
2466
2455
2467
- trusted_cap = get_unaligned_le64 (& ap -> sector_buf [40 ]);
2456
+ trusted_cap = get_unaligned_le64 (& dev -> sector_buf [40 ]);
2468
2457
if (!(trusted_cap & (1ULL << 63 ))) {
2469
2458
ata_dev_dbg (dev ,
2470
2459
"Trusted Computing capability qword not valid!\n" );
@@ -2492,12 +2481,12 @@ static void ata_dev_config_cdl(struct ata_device *dev)
2492
2481
2493
2482
err_mask = ata_read_log_page (dev , ATA_LOG_IDENTIFY_DEVICE ,
2494
2483
ATA_LOG_SUPPORTED_CAPABILITIES ,
2495
- ap -> sector_buf , 1 );
2484
+ dev -> sector_buf , 1 );
2496
2485
if (err_mask )
2497
2486
goto not_supported ;
2498
2487
2499
2488
/* Check Command Duration Limit Supported bits */
2500
- val = get_unaligned_le64 (& ap -> sector_buf [168 ]);
2489
+ val = get_unaligned_le64 (& dev -> sector_buf [168 ]);
2501
2490
if (!(val & BIT_ULL (63 )) || !(val & BIT_ULL (0 )))
2502
2491
goto not_supported ;
2503
2492
@@ -2510,7 +2499,7 @@ static void ata_dev_config_cdl(struct ata_device *dev)
2510
2499
* We must have support for the sense data for successful NCQ commands
2511
2500
* log indicated by the successful NCQ command sense data supported bit.
2512
2501
*/
2513
- val = get_unaligned_le64 (& ap -> sector_buf [8 ]);
2502
+ val = get_unaligned_le64 (& dev -> sector_buf [8 ]);
2514
2503
if (!(val & BIT_ULL (63 )) || !(val & BIT_ULL (47 ))) {
2515
2504
ata_dev_warn (dev ,
2516
2505
"CDL supported but Successful NCQ Command Sense Data is not supported\n" );
@@ -2530,11 +2519,11 @@ static void ata_dev_config_cdl(struct ata_device *dev)
2530
2519
*/
2531
2520
err_mask = ata_read_log_page (dev , ATA_LOG_IDENTIFY_DEVICE ,
2532
2521
ATA_LOG_CURRENT_SETTINGS ,
2533
- ap -> sector_buf , 1 );
2522
+ dev -> sector_buf , 1 );
2534
2523
if (err_mask )
2535
2524
goto not_supported ;
2536
2525
2537
- val = get_unaligned_le64 (& ap -> sector_buf [8 ]);
2526
+ val = get_unaligned_le64 (& dev -> sector_buf [8 ]);
2538
2527
cdl_enabled = val & BIT_ULL (63 ) && val & BIT_ULL (21 );
2539
2528
if (dev -> flags & ATA_DFLAG_CDL_ENABLED ) {
2540
2529
if (!cdl_enabled ) {
@@ -2591,13 +2580,13 @@ static void ata_dev_config_cdl(struct ata_device *dev)
2591
2580
* Command duration limits is supported: cache the CDL log page 18h
2592
2581
* (command duration descriptors).
2593
2582
*/
2594
- err_mask = ata_read_log_page (dev , ATA_LOG_CDL , 0 , ap -> sector_buf , 1 );
2583
+ err_mask = ata_read_log_page (dev , ATA_LOG_CDL , 0 , dev -> sector_buf , 1 );
2595
2584
if (err_mask ) {
2596
2585
ata_dev_warn (dev , "Read Command Duration Limits log failed\n" );
2597
2586
goto not_supported ;
2598
2587
}
2599
2588
2600
- memcpy (dev -> cdl , ap -> sector_buf , ATA_LOG_CDL_SIZE );
2589
+ memcpy (dev -> cdl , dev -> sector_buf , ATA_LOG_CDL_SIZE );
2601
2590
dev -> flags |= ATA_DFLAG_CDL ;
2602
2591
2603
2592
return ;
@@ -2689,7 +2678,7 @@ static void ata_dev_config_fua(struct ata_device *dev)
2689
2678
2690
2679
static void ata_dev_config_devslp (struct ata_device * dev )
2691
2680
{
2692
- u8 * sata_setting = dev -> link -> ap -> sector_buf ;
2681
+ u8 * sata_setting = dev -> sector_buf ;
2693
2682
unsigned int err_mask ;
2694
2683
int i , j ;
2695
2684
@@ -3759,7 +3748,7 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
3759
3748
int ata_dev_reread_id (struct ata_device * dev , unsigned int readid_flags )
3760
3749
{
3761
3750
unsigned int class = dev -> class ;
3762
- u16 * id = (void * )dev -> link -> ap -> sector_buf ;
3751
+ u16 * id = (void * )dev -> sector_buf ;
3763
3752
int rc ;
3764
3753
3765
3754
/* read ID data */
0 commit comments