drm/i915/bios: prefer using dev_priv over dev pointer
authorJani Nikula <jani.nikula@intel.com>
Wed, 16 Dec 2015 13:04:20 +0000 (15:04 +0200)
committerJani Nikula <jani.nikula@intel.com>
Wed, 16 Dec 2015 16:01:50 +0000 (18:01 +0200)
dev_priv is the new black. Or something.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1450271061-32646-3-git-send-email-jani.nikula@intel.com
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_bios.c

index 9cb71b6aed5d37f3eb6907d26a8af0d7b386f6e3..f75988feb566d0822be1bf2d70cd018fb25b29f4 100644 (file)
@@ -370,7 +370,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
        struct drm_i915_private *dev_priv = dev->dev_private;
        int ret;
 
-       ret = intel_bios_init(dev);
+       ret = intel_bios_init(dev_priv);
        if (ret)
                DRM_INFO("failed to find VBIOS tables\n");
 
index fe60b44e7586124bad0454d63884a9e88114e657..18be127f567898cd107986d02273d7c0254befc0 100644 (file)
@@ -3355,7 +3355,7 @@ static inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter)
 extern void intel_i2c_reset(struct drm_device *dev);
 
 /* intel_bios.c */
-int intel_bios_init(struct drm_device *dev);
+int intel_bios_init(struct drm_i915_private *dev_priv);
 bool intel_bios_is_valid_vbt(const void *buf, size_t size);
 
 /* intel_opregion.c */
index 4c9304e92ff526295096f38bfab35d20e4c531b0..25edfc062f9491e5b7b051693b08927c1b79ba04 100644 (file)
@@ -332,10 +332,10 @@ parse_sdvo_panel_data(struct drm_i915_private *dev_priv,
        drm_mode_debug_printmodeline(panel_fixed_mode);
 }
 
-static int intel_bios_ssc_frequency(struct drm_device *dev,
+static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,
                                    bool alternate)
 {
-       switch (INTEL_INFO(dev)->gen) {
+       switch (INTEL_INFO(dev_priv)->gen) {
        case 2:
                return alternate ? 66667 : 48000;
        case 3:
@@ -350,7 +350,6 @@ static void
 parse_general_features(struct drm_i915_private *dev_priv,
                       const struct bdb_header *bdb)
 {
-       struct drm_device *dev = dev_priv->dev;
        const struct bdb_general_features *general;
 
        general = find_section(bdb, BDB_GENERAL_FEATURES);
@@ -362,7 +361,7 @@ parse_general_features(struct drm_i915_private *dev_priv,
                        dev_priv->vbt.int_crt_support = general->int_crt_support;
                dev_priv->vbt.lvds_use_ssc = general->enable_ssc;
                dev_priv->vbt.lvds_ssc_freq =
-                       intel_bios_ssc_frequency(dev, general->ssc_freq);
+                       intel_bios_ssc_frequency(dev_priv, general->ssc_freq);
                dev_priv->vbt.display_clock_mode = general->display_clock_mode;
                dev_priv->vbt.fdi_rx_polarity_inverted = general->fdi_rx_polarity_inverted;
                DRM_DEBUG_KMS("BDB_GENERAL_FEATURES int_tv_support %d int_crt_support %d lvds_use_ssc %d lvds_ssc_freq %d display_clock_mode %d fdi_rx_polarity_inverted %d\n",
@@ -1057,10 +1056,9 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 static void parse_ddi_ports(struct drm_i915_private *dev_priv,
                            const struct bdb_header *bdb)
 {
-       struct drm_device *dev = dev_priv->dev;
        enum port port;
 
-       if (!HAS_DDI(dev))
+       if (!HAS_DDI(dev_priv))
                return;
 
        if (!dev_priv->vbt.child_dev_num)
@@ -1173,7 +1171,6 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 static void
 init_vbt_defaults(struct drm_i915_private *dev_priv)
 {
-       struct drm_device *dev = dev_priv->dev;
        enum port port;
 
        dev_priv->vbt.crt_ddc_pin = GMBUS_PIN_VGADDC;
@@ -1198,8 +1195,8 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
         * Core/SandyBridge/IvyBridge use alternative (120MHz) reference
         * clock for LVDS.
         */
-       dev_priv->vbt.lvds_ssc_freq = intel_bios_ssc_frequency(dev,
-                       !HAS_PCH_SPLIT(dev));
+       dev_priv->vbt.lvds_ssc_freq = intel_bios_ssc_frequency(dev_priv,
+                       !HAS_PCH_SPLIT(dev_priv));
        DRM_DEBUG_KMS("Set default to SSC at %d kHz\n", dev_priv->vbt.lvds_ssc_freq);
 
        for (port = PORT_A; port < I915_MAX_PORTS; port++) {
@@ -1295,15 +1292,14 @@ static const struct vbt_header *find_vbt(void __iomem *bios, size_t size)
  * Returns 0 on success, nonzero on failure.
  */
 int
-intel_bios_init(struct drm_device *dev)
+intel_bios_init(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = dev->dev_private;
-       struct pci_dev *pdev = dev->pdev;
+       struct pci_dev *pdev = dev_priv->dev->pdev;
        const struct vbt_header *vbt = dev_priv->opregion.vbt;
        const struct bdb_header *bdb;
        u8 __iomem *bios = NULL;
 
-       if (HAS_PCH_NOP(dev))
+       if (HAS_PCH_NOP(dev_priv))
                return -ENODEV;
 
        init_vbt_defaults(dev_priv);