drm2: a few minor fixes after r280183

* Remove obsolete drm_agp_*_memory() prototypes.
* Fix comment in drm_fops.c (outisde -> outside).
* Fix some formatting issues in drm_stub.c (spaces -> tabs).
* Add missing case statement (gen == 3) in intel_gpu_reset().
* Restore pci_enable_busmaster() call in the init path (fixes gpu hang on i945GM).
* Replace M_WAITOK with M_NOWAIT when the return value of malloc is checked (may be incorrect).

Submitted by:	<s3erios@gmail.com>
Reviewed by:	dumbbell
Approved by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D3413
This commit is contained in:
Adrian Chadd 2015-10-04 07:45:36 +00:00
parent 06a60e4bb0
commit 280bcab3d0
8 changed files with 19 additions and 24 deletions

View File

@ -1782,12 +1782,6 @@ void drm_driver_irq_preinstall(struct drm_device *dev);
void drm_driver_irq_postinstall(struct drm_device *dev);
void drm_driver_irq_uninstall(struct drm_device *dev);
/* AGP/PCI Express/GART support (drm_agpsupport.c) */
void *drm_agp_allocate_memory(size_t pages, u32 type);
int drm_agp_free_memory(void *handle);
int drm_agp_bind_memory(void *handle, off_t start);
int drm_agp_unbind_memory(void *handle);
/* sysctl support (drm_sysctl.h) */
extern int drm_sysctl_init(struct drm_device *dev);
extern int drm_sysctl_cleanup(struct drm_device *dev);

View File

@ -663,7 +663,7 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
plane->dev = dev;
plane->funcs = funcs;
plane->format_types = malloc(sizeof(uint32_t) * format_count,
DRM_MEM_KMS, M_WAITOK);
DRM_MEM_KMS, M_NOWAIT);
if (!plane->format_types) {
DRM_DEBUG_KMS("out of memory when allocating plane\n");
drm_mode_object_put(dev, &plane->base);
@ -1010,7 +1010,7 @@ int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group)
total_objects += dev->mode_config.num_encoder;
group->id_list = malloc(total_objects * sizeof(uint32_t),
DRM_MEM_KMS, M_WAITOK | M_ZERO);
DRM_MEM_KMS, M_NOWAIT | M_ZERO);
if (!group->id_list)
return -ENOMEM;
@ -1998,7 +1998,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
connector_set = malloc(crtc_req->count_connectors *
sizeof(struct drm_connector *),
DRM_MEM_KMS, M_WAITOK);
DRM_MEM_KMS, M_NOWAIT);
if (!connector_set) {
ret = -ENOMEM;
goto out;
@ -2523,7 +2523,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
goto out_err1;
}
clips = malloc(num_clips * sizeof(*clips), DRM_MEM_KMS,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (!clips) {
ret = -ENOMEM;
goto out_err1;
@ -2774,13 +2774,13 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
int ret;
property = malloc(sizeof(struct drm_property), DRM_MEM_KMS,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (!property)
return NULL;
if (num_values) {
property->values = malloc(sizeof(uint64_t)*num_values, DRM_MEM_KMS,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (!property->values)
goto fail;
}
@ -2908,7 +2908,7 @@ int drm_property_add_enum(struct drm_property *property, int index,
}
prop_enum = malloc(sizeof(struct drm_property_enum), DRM_MEM_KMS,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (!prop_enum)
return -ENOMEM;
@ -3104,7 +3104,7 @@ static struct drm_property_blob *drm_property_create_blob(struct drm_device *dev
return NULL;
blob = malloc(sizeof(struct drm_property_blob)+length, DRM_MEM_KMS,
M_WAITOK | M_ZERO);
M_NOWAIT | M_ZERO);
if (!blob)
return NULL;
@ -3434,7 +3434,7 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
crtc->gamma_size = gamma_size;
crtc->gamma_store = malloc(gamma_size * sizeof(uint16_t) * 3,
DRM_MEM_KMS, M_WAITOK | M_ZERO);
DRM_MEM_KMS, M_NOWAIT | M_ZERO);
if (!crtc->gamma_store) {
crtc->gamma_size = 0;
return -ENOMEM;
@ -3632,7 +3632,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
file_priv->event_space -= sizeof e->event;
mtx_unlock(&dev->event_lock);
e = malloc(sizeof *e, DRM_MEM_KMS, M_WAITOK | M_ZERO);
e = malloc(sizeof *e, DRM_MEM_KMS, M_NOWAIT | M_ZERO);
if (e == NULL) {
mtx_lock(&dev->event_lock);
file_priv->event_space += sizeof e->event;

View File

@ -136,7 +136,7 @@ int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
sx_xlock(&drm_global_mutex);
/*
* FIXME Linux<->FreeBSD: On Linux, counter updated outisde
* FIXME Linux<->FreeBSD: On Linux, counter updated outside
* global mutex.
*/
if (!dev->open_count++)

View File

@ -225,7 +225,7 @@ int drm_pci_set_unique(struct drm_device *dev,
master->unique_len = u->unique_len;
master->unique_size = u->unique_len + 1;
master->unique = malloc(master->unique_size, DRM_MEM_DRIVER, M_WAITOK);
master->unique = malloc(master->unique_size, DRM_MEM_DRIVER, M_NOWAIT);
if (!master->unique) {
ret = -ENOMEM;
goto err;

View File

@ -94,9 +94,9 @@ static int drm_minor_get_id(struct drm_device *dev, int type)
if (type == DRM_MINOR_CONTROL) {
new_id += 64;
} else if (type == DRM_MINOR_RENDER) {
new_id += 128;
}
} else if (type == DRM_MINOR_RENDER) {
new_id += 128;
}
return new_id;
}

View File

@ -1452,6 +1452,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
}
}
pci_enable_busmaster(dev->dev);
intel_opregion_init(dev);
callout_init(&dev_priv->hangcheck_timer, 1);

View File

@ -894,6 +894,7 @@ int intel_gpu_reset(struct drm_device *dev)
case 4:
ret = i965_do_reset(dev);
break;
case 3:
case 2:
ret = i8xx_do_reset(dev);
break;

View File

@ -533,11 +533,9 @@ void intel_opregion_fini(struct drm_device *dev)
opregion->vbt = NULL;
}
#else
int
void
intel_opregion_init(struct drm_device *dev)
{
return (0);
}
void