| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Libata based driver for Apple "macio" family of PATA controllers |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 483 | 484 | struct device_node *root = of_find_node_by_path("/"); |
|---|
| 484 | 485 | const char *model = of_get_property(root, "model", NULL); |
|---|
| 485 | 486 | |
|---|
| 487 | + of_node_put(root); |
|---|
| 488 | + |
|---|
| 486 | 489 | if (cable && !strncmp(cable, "80-", 3)) { |
|---|
| 487 | 490 | /* Some drives fail to detect 80c cable in PowerBook |
|---|
| 488 | 491 | * These machine use proprietary short IDE cable |
|---|
| .. | .. |
|---|
| 915 | 918 | .sg_tablesize = MAX_DCMDS, |
|---|
| 916 | 919 | /* We may not need that strict one */ |
|---|
| 917 | 920 | .dma_boundary = ATA_DMA_BOUNDARY, |
|---|
| 921 | + /* Not sure what the real max is but we know it's less than 64K, let's |
|---|
| 922 | + * use 64K minus 256 |
|---|
| 923 | + */ |
|---|
| 924 | + .max_segment_size = MAX_DBDMA_SEG, |
|---|
| 918 | 925 | .slave_configure = pata_macio_slave_config, |
|---|
| 919 | 926 | }; |
|---|
| 920 | 927 | |
|---|
| .. | .. |
|---|
| 950 | 957 | priv->kind = controller_k2_ata6; |
|---|
| 951 | 958 | priv->timings = pata_macio_kauai_timings; |
|---|
| 952 | 959 | } else if (of_device_is_compatible(priv->node, "keylargo-ata")) { |
|---|
| 953 | | - if (strcmp(priv->node->name, "ata-4") == 0) { |
|---|
| 960 | + if (of_node_name_eq(priv->node, "ata-4")) { |
|---|
| 954 | 961 | priv->kind = controller_kl_ata4; |
|---|
| 955 | 962 | priv->timings = pata_macio_kl66_timings; |
|---|
| 956 | 963 | } else { |
|---|
| .. | .. |
|---|
| 972 | 979 | priv->aapl_bus_id = bidp ? *bidp : 0; |
|---|
| 973 | 980 | |
|---|
| 974 | 981 | /* Fixup missing Apple bus ID in case of media-bay */ |
|---|
| 975 | | - if (priv->mediabay && bidp == 0) |
|---|
| 982 | + if (priv->mediabay && !bidp) |
|---|
| 976 | 983 | priv->aapl_bus_id = 1; |
|---|
| 977 | 984 | } |
|---|
| 978 | 985 | |
|---|
| .. | .. |
|---|
| 1043 | 1050 | |
|---|
| 1044 | 1051 | /* Make sure we have sane initial timings in the cache */ |
|---|
| 1045 | 1052 | pata_macio_default_timings(priv); |
|---|
| 1046 | | - |
|---|
| 1047 | | - /* Not sure what the real max is but we know it's less than 64K, let's |
|---|
| 1048 | | - * use 64K minus 256 |
|---|
| 1049 | | - */ |
|---|
| 1050 | | - dma_set_max_seg_size(priv->dev, MAX_DBDMA_SEG); |
|---|
| 1051 | 1053 | |
|---|
| 1052 | 1054 | /* Allocate libata host for 1 port */ |
|---|
| 1053 | 1055 | memset(&pinfo, 0, sizeof(struct ata_port_info)); |
|---|